Skip to content

Commit 2efd5c5

Browse files
committed
Glyph cache optimization
Precaching at startup was not working. One-liner fix to init the caches so that precaching would kick in earlier, saving time at startup by avoiding the multiple-upload issue of caching at render time. Issue #6893691 long app launch time on manta for some apps comparing to nakasi/stingray Change-Id: Ie5c7f0536ec8ea371c7892e5e09c1db14795531c
1 parent 21029db commit 2efd5c5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

libs/hwui/FontRenderer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ void FontRenderer::flushAllAndInvalidate() {
699699
}
700700

701701
#if DEBUG_FONT_RENDERER
702-
ALOGD("FontRenderer: flushAllAndInvalidatel");
703702
// Erase caches, just as a debugging facility
704703
if (mCacheTextureSmall && mCacheTextureSmall->mTexture) {
705704
memset(mCacheTextureSmall->mTexture, 0,
@@ -792,14 +791,12 @@ void FontRenderer::allocateTextureMemory(CacheTexture* cacheTexture) {
792791

793792
void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyph,
794793
uint32_t* retOriginX, uint32_t* retOriginY) {
794+
checkInit();
795795
cachedGlyph->mIsValid = false;
796796
// If the glyph is too tall, don't cache it
797-
if (mCacheLines.size() == 0 ||
798-
glyph.fHeight + TEXTURE_BORDER_SIZE * 2 > mCacheLines[mCacheLines.size() - 1]->mMaxHeight) {
799-
if (mCacheLines.size() != 0) {
800-
ALOGE("Font size too large to fit in cache. width, height = %i, %i",
801-
(int) glyph.fWidth, (int) glyph.fHeight);
802-
}
797+
if (glyph.fHeight + TEXTURE_BORDER_SIZE * 2 > mCacheLines[mCacheLines.size() - 1]->mMaxHeight) {
798+
ALOGE("Font size too large to fit in cache. width, height = %i, %i",
799+
(int) glyph.fWidth, (int) glyph.fHeight);
803800
return;
804801
}
805802

0 commit comments

Comments
 (0)