summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-07-17 17:32:48 -0700
committerRomain Guy <romainguy@google.com>2012-07-17 17:32:48 -0700
commit8a4ac610e1aaf04931ac1af54b146a7fc8e66114 (patch)
tree72a29e07d41dbf1e85966ec70acba688a93ec90c /libs/hwui/OpenGLRenderer.cpp
parent41a48e4a9984eff92705a0c52104b0abd365521a (diff)
downloadframeworks_base-8a4ac610e1aaf04931ac1af54b146a7fc8e66114.zip
frameworks_base-8a4ac610e1aaf04931ac1af54b146a7fc8e66114.tar.gz
frameworks_base-8a4ac610e1aaf04931ac1af54b146a7fc8e66114.tar.bz2
Don't clear the dirty clip flag if it's not applied
Bug #6833979 Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 64b6c17..a47d732 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -313,6 +313,7 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) {
interrupt();
detachFunctor(functor);
+ mCaches.enableScissor();
if (mDirtyClip) {
setScissorFromClip();
}
@@ -982,7 +983,7 @@ void OpenGLRenderer::clearLayerRegions() {
// The list contains bounds that have already been clipped
// against their initial clip rect, and the current clip
// is likely different so we need to disable clipping here
- mCaches.disableScissor();
+ bool scissorChanged = mCaches.disableScissor();
Vertex mesh[count * 6];
Vertex* vertex = mesh;
@@ -1009,6 +1010,8 @@ void OpenGLRenderer::clearLayerRegions() {
setupDrawVertices(&mesh[0].position[0]);
glDrawArrays(GL_TRIANGLES, 0, count * 6);
+
+ if (scissorChanged) mCaches.enableScissor();
} else {
for (uint32_t i = 0; i < count; i++) {
delete mLayers.itemAt(i);
@@ -1065,16 +1068,31 @@ void OpenGLRenderer::setScissorFromClip() {
Rect clip(*mSnapshot->clipRect);
clip.snapToPixelBoundaries();
- mCaches.setScissor(clip.left, mSnapshot->height - clip.bottom,
- clip.getWidth(), clip.getHeight());
-
- mDirtyClip = false;
+ if (mCaches.setScissor(clip.left, mSnapshot->height - clip.bottom,
+ clip.getWidth(), clip.getHeight())) {
+ mDirtyClip = false;
+ }
}
const Rect& OpenGLRenderer::getClipBounds() {
return mSnapshot->getLocalClip();
}
+bool OpenGLRenderer::quickRejectNoScissor(float left, float top, float right, float bottom) {
+ if (mSnapshot->isIgnored()) {
+ return true;
+ }
+
+ Rect r(left, top, right, bottom);
+ mSnapshot->transform->mapRect(r);
+ r.snapToPixelBoundaries();
+
+ Rect clipRect(*mSnapshot->clipRect);
+ clipRect.snapToPixelBoundaries();
+
+ return !clipRect.intersects(r);
+}
+
bool OpenGLRenderer::quickReject(float left, float top, float right, float bottom) {
if (mSnapshot->isIgnored()) {
return true;
@@ -1112,6 +1130,8 @@ Rect* OpenGLRenderer::getClipRect() {
///////////////////////////////////////////////////////////////////////////////
void OpenGLRenderer::setupDraw(bool clear) {
+ // TODO: It would be best if we could do this before quickReject()
+ // changes the scissor test state
if (clear) clearLayerRegions();
if (mDirtyClip) {
setScissorFromClip();