Optimize glyph cache texture uploads
Only upload the changed area of the glyph cache, not the entire
bitmap. Note that we can't do the full-on optimization here of copying a sub-rect
of the bitmap because of GL ES 2 limitations, but we can at least copy the
horizontal stripe containing the dirty rect, which can still be a big
savings over uploading the entire bitmap.
Issue #7158326 Bad framerates on MR1 (Mako, Manta, Prime)
Change-Id: Iab38d53202650f757ead4658cf4287bdad2b3cb9
diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp
index 4a3af12..f653592 100644
--- a/libs/hwui/font/CacheTexture.cpp
+++ b/libs/hwui/font/CacheTexture.cpp
@@ -171,6 +171,9 @@
}
mDirty = true;
+ const Rect r(*retOriginX - TEXTURE_BORDER_SIZE, *retOriginY - TEXTURE_BORDER_SIZE,
+ *retOriginX + glyphW, *retOriginY + glyphH);
+ mDirtyRect.unionWith(r);
mNumGlyphs++;
#if DEBUG_FONT_RENDERER