summaryrefslogtreecommitdiff
path: root/rsFont.cpp
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-07-08 16:46:18 -0700
committerJason Sams <jsams@google.com>2013-07-08 16:46:18 -0700
commita7f5e0406825151660c1c2e75c287e2fc8368023 (patch)
tree96fff349d90a29ec926b658c1b0e0de95585803f /rsFont.cpp
parent4768dade83376d58dbee788f2a705a63918ee8bc (diff)
downloadrs-a7f5e0406825151660c1c2e75c287e2fc8368023.tar.gz
Remove unnecessary string operations.
Change-Id: I9e59c54e0ac200b5cf8bd35b3746112d0444a8d5
Diffstat (limited to 'rsFont.cpp')
-rw-r--r--rsFont.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/rsFont.cpp b/rsFont.cpp
index 958ecb54..2a2c3b49 100644
--- a/rsFont.cpp
+++ b/rsFont.cpp
@@ -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 ++;