Generate even fewer GL commands
Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index c3bac5d..f2205f6 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -79,6 +79,8 @@
mTexCoordsArrayEnabled = false;
+ mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
+
glActiveTexture(gTextureUnits[0]);
mTextureUnit = 0;
@@ -312,6 +314,17 @@
}
}
+void Caches::setScissor(GLint x, GLint y, GLint width, GLint height) {
+ if (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight) {
+ glScissor(x, y, width, height);
+
+ mScissorX = x;
+ mScissorY = y;
+ mScissorWidth = width;
+ mScissorHeight = height;
+ }
+}
+
TextureVertex* Caches::getRegionMesh() {
// Create the mesh, 2 triangles and 4 vertices per rectangle in the region
if (!mRegionMesh) {