Fix improper clipping after a save()
Change-Id: I13426a67f20d77e2710bd500d82884098f4be97c
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 3c36f95..cc8e6bc 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -177,7 +177,7 @@
}
void OpenGLRenderer::prepare() {
- mSnapshot = mFirstSnapshot;
+ mSnapshot = new Snapshot(mFirstSnapshot);
mSaveCount = 0;
glDisable(GL_SCISSOR_TEST);
@@ -188,7 +188,7 @@
glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, mWidth, mHeight);
- mSnapshot->clipRect.set(0.0f, 0.0f, mWidth, mHeight);
+ mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight);
}
///////////////////////////////////////////////////////////////////////////////
@@ -569,6 +569,7 @@
chooseBlending(true, mode);
bindTexture(mFontRenderer.getTexture(), GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, 0);
+ glUniform1i(mCurrentProgram->getUniform("sampler"), 0);
int texCoordsSlot = mCurrentProgram->getAttrib("texCoords");
glEnableVertexAttribArray(texCoordsSlot);
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index 020bdb0..399ae68 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -57,8 +57,13 @@
flags(0),
previous(s),
layer(NULL),
- fbo(s->fbo),
- localClip(s->localClip) {
+ fbo(s->fbo) {
+ if ((s->flags & Snapshot::kFlagClipSet) &&
+ !(s->flags & Snapshot::kFlagDirtyLocalClip)) {
+ localClip.set(s->localClip);
+ } else {
+ flags |= Snapshot::kFlagDirtyLocalClip;
+ }
}
/**