summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-18 20:48:33 -0700
committerRomain Guy <romainguy@google.com>2010-08-18 20:48:33 -0700
commitc4d8eb6fb7c88c5c4da38b0b113c24cc4b78c0b7 (patch)
tree0cb414e9157cef012ae08395a3cd052a2c5384bc /libs/hwui
parent1b196022ece4305f7619a41a84fe49f792dfb1bc (diff)
downloadframeworks_base-c4d8eb6fb7c88c5c4da38b0b113c24cc4b78c0b7.zip
frameworks_base-c4d8eb6fb7c88c5c4da38b0b113c24cc4b78c0b7.tar.gz
frameworks_base-c4d8eb6fb7c88c5c4da38b0b113c24cc4b78c0b7.tar.bz2
Speedup TextView fades (no more layers required.)
Also fixes a crash in the drop shadows cache and improves drop shadows caching. Change-Id: I9c0208a49467f9201d786ae0c129194b8d423923
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/TextDropShadowCache.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/libs/hwui/TextDropShadowCache.h b/libs/hwui/TextDropShadowCache.h
index 5fbe9e5..c3be483 100644
--- a/libs/hwui/TextDropShadowCache.h
+++ b/libs/hwui/TextDropShadowCache.h
@@ -29,13 +29,18 @@ namespace android {
namespace uirenderer {
struct ShadowText {
- ShadowText() { }
+ ShadowText() {
+ text = NULL;
+ }
ShadowText(SkPaint* paint, uint32_t radius, uint32_t len, const char* srcText):
- paint(paint), radius(radius), len(len) {
+ radius(radius), len(len) {
text = new char[len];
memcpy(text, srcText, len);
+ textSize = paint->getTextSize();
+ typeface = paint->getTypeface();
+
hash = 0;
uint32_t multiplier = 1;
for (uint32_t i = 0; i < len; i++) {
@@ -46,7 +51,8 @@ struct ShadowText {
}
ShadowText(const ShadowText& shadow):
- paint(shadow.paint), radius(shadow.radius), len(shadow.len), hash(shadow.hash) {
+ radius(shadow.radius), len(shadow.len), hash(shadow.hash),
+ textSize(shadow.textSize), typeface(shadow.typeface) {
text = new char[shadow.len];
memcpy(text, shadow.text, shadow.len);
}
@@ -55,10 +61,11 @@ struct ShadowText {
delete[] text;
}
- SkPaint* paint;
uint32_t radius;
uint32_t len;
uint32_t hash;
+ float textSize;
+ SkTypeface* typeface;
char *text;
bool operator<(const ShadowText& rhs) const {
@@ -66,11 +73,14 @@ struct ShadowText {
else if (len == rhs.len) {
if (radius < rhs.radius) return true;
else if (radius == rhs.radius) {
- if (paint < rhs.paint) return true;
- else if (paint == rhs.paint) {
- if (hash < rhs.hash) return true;
- if (hash == rhs.hash) {
- return strncmp(text, rhs.text, len) < 0;
+ if (textSize < rhs.textSize) return true;
+ else if (textSize == rhs.textSize) {
+ if (typeface < rhs.typeface) return true;
+ else if (typeface == rhs.typeface) {
+ if (hash < rhs.hash) return true;
+ if (hash == rhs.hash) {
+ return strncmp(text, rhs.text, len) < 0;
+ }
}
}
}