| 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(¬ificationCounter);
|
| + 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);
|
|
|