summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.h
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.h
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.h')
-rw-r--r--libs/hwui/DisplayListRenderer.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 60a40c6..c8b3e47 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -770,10 +770,10 @@ private:
addInt((int) pathCopy);
}
- inline void addPaint(SkPaint* paint) {
+ inline SkPaint* addPaint(SkPaint* paint) {
if (!paint) {
addInt((int) NULL);
- return;
+ return paint;
}
SkPaint* paintCopy = mPaintMap.valueFor(paint);
@@ -785,6 +785,8 @@ private:
}
addInt((int) paintCopy);
+
+ return paintCopy;
}
inline void addDisplayList(DisplayList* displayList) {