From 4ace7305608442ab35ea9aa65a4220df152c187f Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Sun, 14 Sep 2014 15:49:54 -0700 Subject: [PATCH] Force isolation of clip and matrix within layer bug:17379260 Unclipped save layers need to isolate their clips and matrices so that the save time readout of background content matches clip and position with the restore/compose step. Change-Id: I2de474cda76e960d080852f1716d6ddfa8a512d4 --- libs/hwui/DisplayListRenderer.cpp | 3 +++ libs/hwui/OpenGLRenderer.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 5892978bfdba3..7ee83e609d10a 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -117,6 +117,9 @@ void DisplayListRenderer::restoreToCount(int saveCount) { int DisplayListRenderer::saveLayer(float left, float top, float right, float bottom, const SkPaint* paint, int flags) { + // force matrix/clip isolation for layer + flags |= SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag; + paint = refPaint(paint); addStateOp(new (alloc()) SaveLayerOp(left, top, right, bottom, paint, flags)); return StatefulBaseRenderer::save(flags); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 31cc1c81def7e..74f36abe21295 100755 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -638,6 +638,9 @@ void OpenGLRenderer::onSnapshotRestored(const Snapshot& removed, const Snapshot& int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom, const SkPaint* paint, int flags, const SkPath* convexMask) { + // force matrix/clip isolation for layer + flags |= SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag; + const int count = saveSnapshot(flags); if (!currentSnapshot()->isIgnored()) {