summaryrefslogtreecommitdiff
path: root/libs/hwui/SkiaCanvas.cpp
diff options
context:
space:
mode:
author Derek Sollenberger <djsollen@google.com> 2019-04-22 16:28:09 -0400
committer Derek Sollenberger <djsollen@google.com> 2019-05-02 13:04:20 -0400
commitac33a487516196e9f1cf830e78313806e6daf777 (patch)
treef1738f2d3e8dd3e467b4e5b697590bf912cfb702 /libs/hwui/SkiaCanvas.cpp
parentf06967c08e48143192b136cd4d5d5f805631752e (diff)
Fix fading edge effect from impacting neighboring pixels
Bug: 129117085 Test: skia unit tests and test cases described in the bug Change-Id: Ieaa7c831dd6298ac0565e6f1837b1c1dbd4545da
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r--libs/hwui/SkiaCanvas.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 834069988f42..6ea6af8f2935 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -26,6 +26,7 @@
#include <SkAndroidFrameworkUtils.h>
#include <SkAnimatedImage.h>
+#include <SkCanvasPriv.h>
#include <SkCanvasStateUtils.h>
#include <SkColorFilter.h>
#include <SkDeque.h>
@@ -191,6 +192,18 @@ int SkiaCanvas::saveUnclippedLayer(int left, int top, int right, int bottom) {
return SkAndroidFrameworkUtils::SaveBehind(mCanvas, &bounds);
}
+void SkiaCanvas::restoreUnclippedLayer(int restoreCount, const SkPaint& paint) {
+
+ while (mCanvas->getSaveCount() > restoreCount + 1) {
+ this->restore();
+ }
+
+ if (mCanvas->getSaveCount() == restoreCount + 1) {
+ SkCanvasPriv::DrawBehind(mCanvas, *filterPaint(paint));
+ this->restore();
+ }
+}
+
class SkiaCanvas::Clip {
public:
Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)