Optimize FBO drawing with regions.
This optimization is currently disabled until Launcher is
modified to take advantage of it. The optimization can be
enabled by turning on RENDER_LAYERS_AS_REGIONS in the
OpenGLRenderer.h file.
Change-Id: I2fdf59d0f4dc690a3d7f712173ab8db3848b27b1
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 0dd9c5a..23ccef6 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -169,7 +169,8 @@
int saveCount = renderer.getSaveCount() - 1;
while (!mReader.eof()) {
- switch (mReader.readInt()) {
+ int op = mReader.readInt();
+ switch (op) {
case AcquireContext: {
renderer.acquireContext();
}
@@ -195,6 +196,11 @@
getPaint(), getInt());
}
break;
+ case SaveLayerAlpha: {
+ renderer.saveLayerAlpha(getFloat(), getFloat(), getFloat(), getFloat(),
+ getInt(), getInt());
+ }
+ break;
case Translate: {
renderer.translate(getFloat(), getFloat());
}
@@ -400,6 +406,15 @@
return OpenGLRenderer::save(flags);
}
+int DisplayListRenderer::saveLayerAlpha(float left, float top, float right, float bottom,
+ int alpha, int flags) {
+ addOp(DisplayList::SaveLayerAlpha);
+ addBounds(left, top, right, bottom);
+ addInt(alpha);
+ addInt(flags);
+ return OpenGLRenderer::save(flags);
+}
+
void DisplayListRenderer::translate(float dx, float dy) {
addOp(DisplayList::Translate);
addPoint(dx, dy);