summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2013-08-01 15:29:25 -0700
committer Romain Guy <romainguy@google.com> 2013-08-01 15:35:24 -0700
commitb7b93e00893f5c690a96bd3e0e10583bc5721f83 (patch)
tree89c975e81ab527630ab4c10478b80bca12593d24 /libs/hwui/OpenGLRenderer.cpp
parent5d3dff1d66f99fbd5bef9178e62d789119c02ad1 (diff)
Fix region clipping bugs
See external bug #58344 Change-Id: Iecd6c41fc8076cd76add2335d3442a6dd8878f12
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index be0cd2afb105..36be9a7f0bef 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1668,7 +1668,7 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom,
SkPath path;
path.addRect(left, top, right, bottom);
- return clipPath(&path, op);
+ return OpenGLRenderer::clipPath(&path, op);
}
bool OpenGLRenderer::clipPath(SkPath* path, SkRegion::Op op) {
@@ -1679,11 +1679,15 @@ bool OpenGLRenderer::clipPath(SkPath* path, SkRegion::Op op) {
path->transform(transform, &transformed);
SkRegion clip;
- if (!mSnapshot->clipRegion->isEmpty()) {
- clip.setRegion(*mSnapshot->clipRegion);
+ if (!mSnapshot->previous->clipRegion->isEmpty()) {
+ clip.setRegion(*mSnapshot->previous->clipRegion);
} else {
- Rect* bounds = mSnapshot->clipRect;
- clip.setRect(bounds->left, bounds->top, bounds->right, bounds->bottom);
+ if (mSnapshot->previous == mFirstSnapshot) {
+ clip.setRect(0, 0, mWidth, mHeight);
+ } else {
+ Rect* bounds = mSnapshot->previous->clipRect;
+ clip.setRect(bounds->left, bounds->top, bounds->right, bounds->bottom);
+ }
}
SkRegion region;