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

Unified Diff: tests/DeferredCanvasTest.cpp

Issue 15594004: Fixing deferred canvases so that they do not return deferred devices on createCompatibleDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 9222)
+++ tests/DeferredCanvasTest.cpp (working copy)
@@ -548,6 +548,28 @@
REPORTER_ASSERT(reporter, pixels4 == pixels5);
}
+static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporter) {
+ SkBitmap store;
+ store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
+ store.allocPixels();
+ SkDevice device(store);
+ NotificationCounter notificationCounter;
+ SkDeferredCanvas canvas(&device);
+ canvas.setNotificationClient(&notificationCounter);
+ SkAutoTUnref<SkDevice> secondaryDevice(canvas.createCompatibleDevice(
+ SkBitmap::kARGB_8888_Config, 10, 10, device.isOpaque()));
+ SkCanvas secondaryCanvas(secondaryDevice.get());
+ SkRect rect = SkRect::MakeWH(5, 5);
+ SkPaint paint;
+ // After spawning a compatible canvas:
+ // 1) Verify that secondary canvas is usable and does not report to the notification client.
+ secondaryCanvas.drawRect(rect, paint);
+ REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount == 0);
+ // 2) Verify that original canvas is usable and still reports to the notification client.
+ canvas.drawRect(rect, paint);
+ REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount == 1);
+}
+
static void TestDeferredCanvas(skiatest::Reporter* reporter, GrContextFactory* factory) {
TestDeferredCanvasBitmapAccess(reporter);
TestDeferredCanvasFlush(reporter);
@@ -557,6 +579,7 @@
TestDeferredCanvasSkip(reporter);
TestDeferredCanvasBitmapShaderNoLeak(reporter);
TestDeferredCanvasBitmapSizeThreshold(reporter);
+ TestDeferredCanvasCreateCompatibleDevice(reporter);
TestDeferredCanvasSurface(reporter, NULL);
if (NULL != factory) {
TestDeferredCanvasSurface(reporter, 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