Loading libs/rs/rsFont.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #include "rsFont.h" #include "rsProgramFragment.h" #include <cutils/properties.h> #include <ft2build.h> #include FT_FREETYPE_H #include FT_BITMAP_H #include <GLES/gl.h> Loading Loading @@ -208,7 +211,7 @@ void Font::renderUTF(const char *text, uint32_t len, int32_t x, int32_t y, } } penX += (cachedGlyph->mAdvance.x >> 6); penX += (cachedGlyph->mAdvanceX >> 6); // If we were given a specific number of glyphs, decrement if (numGlyphs > 0) { Loading Loading @@ -238,7 +241,8 @@ void Font::updateGlyphCache(CachedGlyphInfo *glyph) { return; } glyph->mAdvance = mFace->glyph->advance; glyph->mAdvanceX = mFace->glyph->advance.x; glyph->mAdvanceY = mFace->glyph->advance.y; glyph->mBitmapLeft = mFace->glyph->bitmap_left; glyph->mBitmapTop = mFace->glyph->bitmap_top; Loading Loading @@ -803,6 +807,22 @@ void FontState::deinit(Context *rsc) { } } bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) { if ((uint32_t)bitmap->rows > mMaxHeight) { return false; } if (mCurrentCol + (uint32_t)bitmap->width < mMaxWidth) { *retOriginX = mCurrentCol; *retOriginY = mCurrentRow; mCurrentCol += bitmap->width; mDirty = true; return true; } return false; } namespace android { namespace renderscript { Loading libs/rs/rsFont.h +13 −25 Original line number Diff line number Diff line Loading @@ -23,8 +23,9 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> #include <ft2build.h> #include FT_FREETYPE_H struct FT_LibraryRec_; struct FT_FaceRec_; struct FT_Bitmap_; // --------------------------------------------------------------------------- namespace android { Loading Loading @@ -105,11 +106,12 @@ protected: float mBitmapMaxU; float mBitmapMaxV; // Minimize how much we call freetype FT_UInt mGlyphIndex; FT_Vector mAdvance; int32_t mGlyphIndex; int32_t mAdvanceX; int32_t mAdvanceY; // Values below contain a glyph's origin in the bitmap FT_Int mBitmapLeft; FT_Int mBitmapTop; int32_t mBitmapLeft; int32_t mBitmapTop; }; String8 mFontName; Loading @@ -120,7 +122,7 @@ protected: bool init(const char *name, float fontSize, uint32_t dpi, const void *data = NULL, uint32_t dataLen = 0); virtual void preDestroy() const; FT_Face mFace; FT_FaceRec_ *mFace; bool mInitialized; bool mHasKerning; Loading Loading @@ -173,21 +175,7 @@ protected: mCurrentCol(currentCol), mDirty(false) { } bool fitBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) { if ((uint32_t)bitmap->rows > mMaxHeight) { return false; } if (mCurrentCol + (uint32_t)bitmap->width < mMaxWidth) { *retOriginX = mCurrentCol; *retOriginY = mCurrentRow; mCurrentCol += bitmap->width; mDirty = true; return true; } return false; } bool fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); }; Vector<CacheTextureLine*> mCacheLines; Loading @@ -211,8 +199,8 @@ protected: float mWhiteThreshold; // Free type library, we only need one copy FT_Library mLibrary; FT_Library getLib(); FT_LibraryRec_ *mLibrary; FT_LibraryRec_ *getLib(); Vector<Font*> mActiveFonts; // Render state for the font Loading @@ -229,7 +217,7 @@ protected: return (uint8_t*)mTextTexture->getPtr(); } bool cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); bool cacheBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); const Type* getCacheTextureType() { return mTextTexture->getType(); } Loading libs/rs/rsScriptC.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ extern "C" { #include <GLES/gl.h> #include <GLES/glext.h> #include <bcc/bcc.h> using namespace android; using namespace android::renderscript; Loading libs/rs/rsScriptC.h +2 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include "RenderScriptEnv.h" #include <bcc/bcc.h> struct BCCOpaqueScript; // --------------------------------------------------------------------------- namespace android { Loading Loading @@ -50,7 +50,7 @@ public: Program_t mProgram; BCCScriptRef mBccScript; BCCOpaqueScript *mBccScript; const Allocation *ptrToAllocation(const void *) const; Loading Loading
libs/rs/rsFont.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #include "rsFont.h" #include "rsProgramFragment.h" #include <cutils/properties.h> #include <ft2build.h> #include FT_FREETYPE_H #include FT_BITMAP_H #include <GLES/gl.h> Loading Loading @@ -208,7 +211,7 @@ void Font::renderUTF(const char *text, uint32_t len, int32_t x, int32_t y, } } penX += (cachedGlyph->mAdvance.x >> 6); penX += (cachedGlyph->mAdvanceX >> 6); // If we were given a specific number of glyphs, decrement if (numGlyphs > 0) { Loading Loading @@ -238,7 +241,8 @@ void Font::updateGlyphCache(CachedGlyphInfo *glyph) { return; } glyph->mAdvance = mFace->glyph->advance; glyph->mAdvanceX = mFace->glyph->advance.x; glyph->mAdvanceY = mFace->glyph->advance.y; glyph->mBitmapLeft = mFace->glyph->bitmap_left; glyph->mBitmapTop = mFace->glyph->bitmap_top; Loading Loading @@ -803,6 +807,22 @@ void FontState::deinit(Context *rsc) { } } bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) { if ((uint32_t)bitmap->rows > mMaxHeight) { return false; } if (mCurrentCol + (uint32_t)bitmap->width < mMaxWidth) { *retOriginX = mCurrentCol; *retOriginY = mCurrentRow; mCurrentCol += bitmap->width; mDirty = true; return true; } return false; } namespace android { namespace renderscript { Loading
libs/rs/rsFont.h +13 −25 Original line number Diff line number Diff line Loading @@ -23,8 +23,9 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> #include <ft2build.h> #include FT_FREETYPE_H struct FT_LibraryRec_; struct FT_FaceRec_; struct FT_Bitmap_; // --------------------------------------------------------------------------- namespace android { Loading Loading @@ -105,11 +106,12 @@ protected: float mBitmapMaxU; float mBitmapMaxV; // Minimize how much we call freetype FT_UInt mGlyphIndex; FT_Vector mAdvance; int32_t mGlyphIndex; int32_t mAdvanceX; int32_t mAdvanceY; // Values below contain a glyph's origin in the bitmap FT_Int mBitmapLeft; FT_Int mBitmapTop; int32_t mBitmapLeft; int32_t mBitmapTop; }; String8 mFontName; Loading @@ -120,7 +122,7 @@ protected: bool init(const char *name, float fontSize, uint32_t dpi, const void *data = NULL, uint32_t dataLen = 0); virtual void preDestroy() const; FT_Face mFace; FT_FaceRec_ *mFace; bool mInitialized; bool mHasKerning; Loading Loading @@ -173,21 +175,7 @@ protected: mCurrentCol(currentCol), mDirty(false) { } bool fitBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) { if ((uint32_t)bitmap->rows > mMaxHeight) { return false; } if (mCurrentCol + (uint32_t)bitmap->width < mMaxWidth) { *retOriginX = mCurrentCol; *retOriginY = mCurrentRow; mCurrentCol += bitmap->width; mDirty = true; return true; } return false; } bool fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); }; Vector<CacheTextureLine*> mCacheLines; Loading @@ -211,8 +199,8 @@ protected: float mWhiteThreshold; // Free type library, we only need one copy FT_Library mLibrary; FT_Library getLib(); FT_LibraryRec_ *mLibrary; FT_LibraryRec_ *getLib(); Vector<Font*> mActiveFonts; // Render state for the font Loading @@ -229,7 +217,7 @@ protected: return (uint8_t*)mTextTexture->getPtr(); } bool cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); bool cacheBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); const Type* getCacheTextureType() { return mTextTexture->getType(); } Loading
libs/rs/rsScriptC.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ extern "C" { #include <GLES/gl.h> #include <GLES/glext.h> #include <bcc/bcc.h> using namespace android; using namespace android::renderscript; Loading
libs/rs/rsScriptC.h +2 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include "RenderScriptEnv.h" #include <bcc/bcc.h> struct BCCOpaqueScript; // --------------------------------------------------------------------------- namespace android { Loading Loading @@ -50,7 +50,7 @@ public: Program_t mProgram; BCCScriptRef mBccScript; BCCOpaqueScript *mBccScript; const Allocation *ptrToAllocation(const void *) const; Loading