summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.cpp
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-08-09 13:39:02 -0700
committerChet Haase <chet@google.com>2012-08-14 10:33:30 -0700
commite816baea651476aca4407200d4a5e629b9ab8dfa (patch)
tree03d9a7d4bdda72e8811486706cb67152a43e7966 /libs/hwui/DisplayListRenderer.cpp
parent38cc2a5a3ad076fbbb0824a91f49730a4297549b (diff)
downloadframeworks_base-e816baea651476aca4407200d4a5e629b9ab8dfa.zip
frameworks_base-e816baea651476aca4407200d4a5e629b9ab8dfa.tar.gz
frameworks_base-e816baea651476aca4407200d4a5e629b9ab8dfa.tar.bz2
Optimize interactions with glyph cache
There are two fixes here: - precaching: instead of caching-then-drawing whenever there is a new glyph, we cache at DisplayList record time. Then when we finally draw that DisplayList, we just upload the affected texture(s) once, instead of once per change. This is a huge savings in upload time, especially when there are larger glyphs being used by the app. - packing: Previously, glyphs would line up horizontally on each cache line, leaving potentially tons of space vertically, especially when smaller glyphs got put into cache lines intended for large glyphs (which can happen when an app uses lots of unique glyphs, a common case with, for example, chinese/japanese/korean languages). The new approach packs glyphs vertically as well as horizontally to use the space more efficiently and provide space for more glyphs in these situations. Change-Id: I84338aa25db208c7bf13f3f92b4d05ed40c33527
Diffstat (limited to 'libs/hwui/DisplayListRenderer.cpp')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 95fc2c5..2de70d4 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -1699,7 +1699,9 @@ status_t DisplayListRenderer::drawTextOnPath(const char* text, int bytesCount, i
addFloat(hOffset);
addFloat(vOffset);
paint->setAntiAlias(true);
- addPaint(paint);
+ SkPaint* addedPaint = addPaint(paint);
+ FontRenderer& fontRenderer = mCaches.fontRenderer->getFontRenderer(addedPaint);
+ fontRenderer.precache(addedPaint, text, count);
return DrawGlInfo::kStatusDone;
}
@@ -1711,7 +1713,9 @@ status_t DisplayListRenderer::drawPosText(const char* text, int bytesCount, int
addInt(count);
addFloats(positions, count * 2);
paint->setAntiAlias(true);
- addPaint(paint);
+ SkPaint* addedPaint = addPaint(paint);
+ FontRenderer& fontRenderer = mCaches.fontRenderer->getFontRenderer(addedPaint);
+ fontRenderer.precache(addedPaint, text, count);
return DrawGlInfo::kStatusDone;
}
@@ -1742,7 +1746,11 @@ status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int cou
addFloat(x);
addFloat(y);
addFloats(positions, count * 2);
- addPaint(paint);
+ SkPaint* addedPaint = addPaint(paint);
+ if (!reject) {
+ FontRenderer& fontRenderer = mCaches.fontRenderer->getFontRenderer(addedPaint);
+ fontRenderer.precache(addedPaint, text, count);
+ }
addFloat(length);
addSkip(location);
return DrawGlInfo::kStatusDone;