Clip buffer damage to viewport bounds
bug:27287946
Change-Id: Ief3ae9c2dd92196b7d09f1b9fadf009eb228d80a
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp
index 54f38e8..5f984b5 100644
--- a/libs/hwui/renderstate/OffscreenBufferPool.cpp
+++ b/libs/hwui/renderstate/OffscreenBufferPool.cpp
@@ -54,6 +54,14 @@
return Rect(0, viewportHeight * texY, viewportWidth * texX, 0);
}
+void OffscreenBuffer::dirty(Rect dirtyArea) {
+ dirtyArea.doIntersect(0, 0, viewportWidth, viewportHeight);
+ if (!dirtyArea.isEmpty()) {
+ region.orSelf(android::Rect(dirtyArea.left, dirtyArea.top,
+ dirtyArea.right, dirtyArea.bottom));
+ }
+}
+
void OffscreenBuffer::updateMeshFromRegion() {
// avoid T-junctions as they cause artifacts in between the resultant
// geometry when complex transforms occur.