diff options
author | Jason Sams <jsams@google.com> | 2013-07-08 16:46:18 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2013-07-08 16:46:18 -0700 |
commit | a7f5e0406825151660c1c2e75c287e2fc8368023 (patch) | |
tree | 96fff349d90a29ec926b658c1b0e0de95585803f /rsFont.cpp | |
parent | 4768dade83376d58dbee788f2a705a63918ee8bc (diff) | |
download | rs-a7f5e0406825151660c1c2e75c287e2fc8368023.tar.gz |
Remove unnecessary string operations.
Change-Id: I9e59c54e0ac200b5cf8bd35b3746112d0444a8d5
Diffstat (limited to 'rsFont.cpp')
-rw-r--r-- | rsFont.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -640,11 +640,9 @@ 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"); - + mLatinPrecache = " eisarntolcdugpmhbyfvkwzxjq" + "EISARNTOLCDUGPMHBYFVKWZXJQ" + ",.?!()-+@;:`'0123456789"; mInitialized = true; } @@ -740,7 +738,8 @@ void FontState::precacheLatin(Font *font) { // Remaining capacity is measured in % uint32_t remainingCapacity = getRemainingCacheCapacity(); uint32_t precacheIdx = 0; - while (remainingCapacity > 25 && precacheIdx < mLatinPrecache.size()) { + const size_t l = strlen(mLatinPrecache); + while ((remainingCapacity > 25) && (precacheIdx < l)) { font->getCachedUTFChar((int32_t)mLatinPrecache[precacheIdx]); remainingCapacity = getRemainingCacheCapacity(); precacheIdx ++; |