diff options
author | Alex Sakhartchouk <alexst@google.com> | 2011-02-25 09:34:33 -0800 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2011-02-25 09:34:33 -0800 |
commit | 02000b3cdcb2ac369bd06313932b26d4b8e023a9 (patch) | |
tree | 44b367a91700fa6648086db501799096839c87f1 /rsFont.cpp | |
parent | 8ceb281cdc9297a7dbbedb790b0e2acb5bd146f7 (diff) | |
download | rs-02000b3cdcb2ac369bd06313932b26d4b8e023a9.tar.gz |
Moving dependency includes out of librs headers.
When we want to use it on the host, we shouldn't need to go hunting for every external dependency
Change-Id: I885262acdcdf5ede4a9392235f35d5e2f7038e8b
Diffstat (limited to 'rsFont.cpp')
-rw-r--r-- | rsFont.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -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> @@ -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) { @@ -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; @@ -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 { |