Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: tests/CanvasTest.cpp

Issue 1068883004: restore clipstack to heap-ptr, so clients can ref it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CanvasTest.cpp
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index d709a935a661a509ae70de86ad4072a0ddfb9276..646d5150e939fb99559bfc3d4ef83bcd0d2ffc0d 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) {
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698