From 27f50523a45100f3b4861762b6263e0b9ba6e22e Mon Sep 17 00:00:00 2001 From: Alex Sakhartchouk Date: Wed, 18 Aug 2010 15:46:43 -0700 Subject: Renderscript samples. Merged two model related projects. Cleanup. Change-Id: I6fdc70420eee7dfecf0b051fd687e5797c6580ce --- libs/rs/rsFont.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libs/rs/rsFont.cpp') diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp index 1ef9c93..7661d49 100644 --- a/libs/rs/rsFont.cpp +++ b/libs/rs/rsFont.cpp @@ -218,6 +218,7 @@ Font::CachedGlyphInfo *Font::cacheGlyph(uint32_t glyph) Font * Font::create(Context *rsc, const char *name, uint32_t fontSize, uint32_t dpi) { + rsc->mStateFont.checkInit(); Vector &activeFonts = rsc->mStateFont.mActiveFonts; for(uint32_t i = 0; i < activeFonts.size(); i ++) { @@ -513,6 +514,12 @@ void FontState::checkInit() initVertexArrayBuffers(); + // We store a string with letters in a rough frequency of occurrence + mLatinPrecache = String8(" eisarntolcdugpmhbyfvkwzxjq"); + mLatinPrecache += String8("EISARNTOLCDUGPMHBYFVKWZXJQ"); + mLatinPrecache += String8(",.?!()-+@;:`'"); + mLatinPrecache += String8("0123456789"); + mInitialized = true; } @@ -622,7 +629,7 @@ void FontState::appendMeshQuad(float x1, float y1, float z1, uint32_t FontState::getRemainingCacheCapacity() { uint32_t remainingCapacity = 0; - float totalPixels = 0; + uint32_t totalPixels = 0; for(uint32_t i = 0; i < mCacheLines.size(); i ++) { remainingCapacity += (mCacheLines[i]->mMaxWidth - mCacheLines[i]->mCurrentCol); totalPixels += mCacheLines[i]->mMaxWidth; @@ -666,12 +673,6 @@ void FontState::renderText(const char *text, uint32_t len, uint32_t startIndex, issueDrawCommand(); mCurrentQuadIndex = 0; } - - // We store a string with letters in a rough frequency of occurrence - mLatinPrecache = String8(" eisarntolcdugpmhbyfvkwzxjq"); - mLatinPrecache += String8("EISARNTOLCDUGPMHBYFVKWZXJQ"); - mLatinPrecache += String8(",.?!()-+@;:`'"); - mLatinPrecache += String8("0123456789"); } void FontState::renderText(const char *text, int x, int y) -- cgit v1.1