summaryrefslogtreecommitdiff
path: root/libs/hwui/Caches.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2011-12-14 19:23:32 -0800
committer Romain Guy <romainguy@google.com> 2011-12-14 19:23:32 -0800
commit8f85e80b64b89fd38cc23b129f61ec36ddde7f15 (patch)
treebac2bd06357532f524277551c7606ad2471f7be8 /libs/hwui/Caches.cpp
parent2d4fd364843d3efc6e6ee59ccc5beb513a86d789 (diff)
Generate even fewer GL commands
Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
Diffstat (limited to 'libs/hwui/Caches.cpp')
-rw-r--r--libs/hwui/Caches.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index c3bac5d2eedb..f2205f65974e 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -79,6 +79,8 @@ void Caches::init() {
mTexCoordsArrayEnabled = false;
+ mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
+
glActiveTexture(gTextureUnits[0]);
mTextureUnit = 0;
@@ -312,6 +314,17 @@ void Caches::activeTexture(GLuint textureUnit) {
}
}
+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) {