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

Unified Diff: tests/DeferredCanvasTest.cpp

Issue 14263015: Fix crash with SkDeferredCanvas+SkSurface integration with in order draw buffer. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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/utils/SkDeferredCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DeferredCanvasTest.cpp
===================================================================
--- tests/DeferredCanvasTest.cpp (revision 8683)
+++ tests/DeferredCanvasTest.cpp (working copy)
@@ -527,16 +527,25 @@
// write
PixelPtr pixels2 = getSurfacePixelPtr(surface, useGpu);
REPORTER_ASSERT(reporter, pixels1 != pixels2);
- canvas.clear(SK_ColorWHITE);
- canvas.flush();
+ // Verify copy-on write with a draw operation that gets deferred by
+ // the in order draw buffer.
+ SkPaint paint;
+ canvas.drawPaint(paint);
+ SkImage* image4 = canvas.newImageSnapshot(); // implicit flush
+ SkAutoTUnref<SkImage> aur_i4(image4);
+ REPORTER_ASSERT(reporter, image4->uniqueID() != image3->uniqueID());
PixelPtr pixels3 = getSurfacePixelPtr(surface, useGpu);
+ REPORTER_ASSERT(reporter, pixels2 != pixels3);
// Verify that a direct canvas flush with a pending draw does not trigger
// a copy on write when the surface is not sharing its buffer with an
// SkImage.
- canvas.clear(SK_ColorBLACK);
+ canvas.clear(SK_ColorWHITE);
canvas.flush();
PixelPtr pixels4 = getSurfacePixelPtr(surface, useGpu);
- REPORTER_ASSERT(reporter, pixels3 == pixels4);
+ canvas.drawPaint(paint);
+ canvas.flush();
+ PixelPtr pixels5 = getSurfacePixelPtr(surface, useGpu);
+ REPORTER_ASSERT(reporter, pixels4 == pixels5);
}
static void TestDeferredCanvas(skiatest::Reporter* reporter, GrContextFactory* factory) {
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698