summaryrefslogtreecommitdiffstats
path: root/libs/hwui/TextDropShadowCache.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-02-03 15:06:05 -0800
committerRomain Guy <romainguy@google.com>2011-02-03 16:20:08 -0800
commit2fc941e4650d618ff6e122f28b616d9032ffa134 (patch)
treec05148e4502efbb492d93e45386601eab522faa4 /libs/hwui/TextDropShadowCache.h
parentef36255f876aa1a61dcf5e879f4380887dda3854 (diff)
downloadframeworks_base-2fc941e4650d618ff6e122f28b616d9032ffa134.zip
frameworks_base-2fc941e4650d618ff6e122f28b616d9032ffa134.tar.gz
frameworks_base-2fc941e4650d618ff6e122f28b616d9032ffa134.tar.bz2
Fixes cache misses and extra allocations.
Bug #3421454 Change-Id: If4d5c960a7e4c581a9d213073e658284b4e1c497
Diffstat (limited to 'libs/hwui/TextDropShadowCache.h')
-rw-r--r--libs/hwui/TextDropShadowCache.h30
1 files changed, 9 insertions, 21 deletions
diff --git a/libs/hwui/TextDropShadowCache.h b/libs/hwui/TextDropShadowCache.h
index 8cefc8c..ffccfa2 100644
--- a/libs/hwui/TextDropShadowCache.h
+++ b/libs/hwui/TextDropShadowCache.h
@@ -32,7 +32,7 @@ namespace android {
namespace uirenderer {
struct ShadowText {
- ShadowText(): radius(0), len(0), hash(0), textSize(0.0f), typeface(NULL) {
+ ShadowText(): radius(0), len(0), textSize(0.0f), typeface(NULL) {
}
ShadowText(SkPaint* paint, uint32_t radius, uint32_t len, const char* srcText):
@@ -42,20 +42,11 @@ struct ShadowText {
textSize = paint->getTextSize();
typeface = paint->getTypeface();
-
- hash = 0;
- uint32_t multiplier = 1;
- const char* text = str.string();
- for (uint32_t i = 0; i < len; i++) {
- hash += text[i] * multiplier;
- uint32_t shifted = multiplier << 5;
- multiplier = shifted - multiplier;
- }
}
ShadowText(const ShadowText& shadow):
- radius(shadow.radius), len(shadow.len), hash(shadow.hash),
- textSize(shadow.textSize), typeface(shadow.typeface), str(shadow.str) {
+ radius(shadow.radius), len(shadow.len), textSize(shadow.textSize),
+ typeface(shadow.typeface), str(shadow.str) {
}
~ShadowText() {
@@ -63,20 +54,17 @@ struct ShadowText {
uint32_t radius;
uint32_t len;
- uint32_t hash;
float textSize;
SkTypeface* typeface;
String8 str;
bool operator<(const ShadowText& rhs) const {
- LTE_INT(hash) {
- LTE_INT(len) {
- LTE_INT(radius) {
- LTE_FLOAT(textSize) {
- if (typeface < rhs.typeface) return true;
- else if (typeface == rhs.typeface) {
- return str.compare(rhs.str) < 0;
- }
+ LTE_INT(len) {
+ LTE_INT(radius) {
+ LTE_FLOAT(textSize) {
+ if (typeface < rhs.typeface) return true;
+ else if (typeface == rhs.typeface) {
+ return str.compare(rhs.str) < 0;
}
}
}