aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-11-29 13:46:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-29 20:59:38 +0000
commit1a42791a58c4a8e4d83def7efdec700ff443ea6c (patch)
tree65be0db0009df0a057ddd99f49b025879b134f97
parent06826d9d204b88c4c33ad53c823ccbca8dee60f7 (diff)
Make SkNWayCanvas use conservative clipping.
Like most other canvas subclasses, its clips don't need to be perfect. BUG=chromium:668925 Change-Id: I107f8ed6fa60654426fd52c066b1018d5801850d Reviewed-on: https://skia-review.googlesource.com/5308 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Reed <reed@google.com>
-rw-r--r--include/core/SkCanvas.h1
-rw-r--r--src/utils/SkNWayCanvas.cpp2
-rw-r--r--tests/CanvasTest.cpp2
3 files changed, 3 insertions, 2 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index aabc7d81a9..23e1c9f077 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1623,6 +1623,7 @@ private:
friend class SkRecorder; // InitFlags
friend class SkLiteRecorder; // InitFlags
friend class SkNoSaveLayerCanvas; // InitFlags
+ friend class SkNWayCanvas; // InitFlags
friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProps*, InitFlags)
friend class SkPictureRecord; // predrawNotify (why does it need it? <reed>)
friend class SkPicturePlayback; // SaveFlagsToSaveLayerFlags
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index a910284da0..d81a8efbea 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -7,7 +7,7 @@
#include "SkNWayCanvas.h"
SkNWayCanvas::SkNWayCanvas(int width, int height)
- : INHERITED(width, height) {}
+ : INHERITED(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag) {}
SkNWayCanvas::~SkNWayCanvas() {
this->removeAll();
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 1824c25aad..f460ab6e3b 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -694,7 +694,7 @@ DEF_TEST(PaintFilterCanvas_ConsistentState, reporter) {
filterCanvas.scale(0.75f, 0.5f);
REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMatrix());
REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getClipBounds(&clip2));
- REPORTER_ASSERT(reporter, clip1 == clip2);
+ REPORTER_ASSERT(reporter, clip2.contains(clip1));
#ifdef SK_EXPERIMENTAL_SHADOWING
SkShadowTestCanvas* tCanvas = new SkShadowTestCanvas(100,100, reporter);