aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CanvasTest.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-04-07 08:00:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-07 08:00:56 -0700
commit687fa1c745febb57f42b0d5f03d7c1f4be2530ca (patch)
treee1787c146eb0721e978b1d39ed73367af8f2d622 /tests/CanvasTest.cpp
parent04abf130bb15c5cdaa2d895ef5b39698a7fb2419 (diff)
restore clipstack to heap-ptr, so clients can ref it
Diffstat (limited to 'tests/CanvasTest.cpp')
-rw-r--r--tests/CanvasTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index d709a935a6..646d5150e9 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -45,6 +45,7 @@
*/
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkClipStack.h"
#include "SkDeferredCanvas.h"
#include "SkDevice.h"
#include "SkDocument.h"
@@ -217,6 +218,18 @@ static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
REPORTER_ASSERT(reporter, equal_clips(c, *canvas));
}
+static void test_clipstack(skiatest::Reporter* reporter) {
+ // The clipstack is refcounted, and needs to be able to out-live the canvas if a client has
+ // ref'd it.
+ const SkClipStack* cs = NULL;
+ {
+ SkCanvas canvas(10, 10);
+ cs = SkRef(canvas.getClipStack());
+ }
+ REPORTER_ASSERT(reporter, cs->unique());
+ cs->unref();
+}
+
// Format strings that describe the test context. The %s token is where
// the name of the test step is inserted. The context is required for
// disambiguating the error in the case of failures that are reported in
@@ -671,6 +684,7 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const Tes
if (false) { // avoid bit rot, suppress warning
test_clipVisitor(reporter, &referenceCanvas);
}
+ test_clipstack(reporter);
}
static void test_newraster(skiatest::Reporter* reporter) {