Refactor GammaFontRenderer
This change is the first step to a shader-based text antialias
gamma correction.
Change-Id: I9eb02d4c56cb95d05219f712290c865b46141954
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 214cc92..56eb317 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -49,6 +49,7 @@
Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
init();
+ initFont();
initExtensions();
initConstraints();
@@ -74,6 +75,7 @@
mTexCoordsArrayEnabled = false;
+ glDisable(GL_SCISSOR_TEST);
scissorEnabled = false;
mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
@@ -90,6 +92,10 @@
mInitialized = true;
}
+void Caches::initFont() {
+ fontRenderer = GammaFontRenderer::createRenderer();
+}
+
void Caches::initExtensions() {
if (extensions.hasDebugMarker()) {
eventMark = glInsertEventMarkerEXT;
@@ -170,8 +176,8 @@
arcShapeCache.getSize(), arcShapeCache.getMaxSize());
log.appendFormat(" TextDropShadowCache %8d / %8d\n", dropShadowCache.getSize(),
dropShadowCache.getMaxSize());
- for (uint32_t i = 0; i < fontRenderer.getFontRendererCount(); i++) {
- const uint32_t size = fontRenderer.getFontRendererSize(i);
+ for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
+ const uint32_t size = fontRenderer->getFontRendererSize(i);
log.appendFormat(" FontRenderer %d %8d / %8d\n", i, size, size);
}
log.appendFormat("Other:\n");
@@ -191,8 +197,8 @@
total += ovalShapeCache.getSize();
total += rectShapeCache.getSize();
total += arcShapeCache.getSize();
- for (uint32_t i = 0; i < fontRenderer.getFontRendererCount(); i++) {
- total += fontRenderer.getFontRendererSize(i);
+ for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
+ total += fontRenderer->getFontRendererSize(i);
}
log.appendFormat("Total memory usage:\n");
@@ -245,10 +251,10 @@
patchCache.clear();
dropShadowCache.clear();
gradientCache.clear();
- fontRenderer.clear();
+ fontRenderer->clear();
// fall through
case kFlushMode_Moderate:
- fontRenderer.flush();
+ fontRenderer->flush();
textureCache.flush();
pathCache.clear();
roundRectShapeCache.clear();