Optimize display lists
Remove redundant or useless operations
Change-Id: If989b4eaa9143eef4254c38b39959aeed1f2b9ab
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 88cfc5a..cedf456 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -194,6 +194,7 @@
void DisplayList::init() {
mSize = 0;
+ mIsRenderable = true;
}
size_t DisplayList::getSize() {
@@ -892,7 +893,7 @@
// Base structure
///////////////////////////////////////////////////////////////////////////////
-DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE) {
+DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE), mHasDrawOps(false) {
}
DisplayListRenderer::~DisplayListRenderer() {
@@ -926,6 +927,8 @@
mPathMap.clear();
mMatrices.clear();
+
+ mHasDrawOps = false;
}
///////////////////////////////////////////////////////////////////////////////
@@ -938,6 +941,7 @@
} else {
displayList->initFromDisplayListRenderer(*this, true);
}
+ displayList->setRenderable(mHasDrawOps);
return displayList;
}
@@ -982,7 +986,11 @@
}
void DisplayListRenderer::restore() {
- addOp(DisplayList::Restore);
+ if (mRestoreSaveCount < 0) {
+ addOp(DisplayList::Restore);
+ } else {
+ mRestoreSaveCount--;
+ }
OpenGLRenderer::restore();
}