if (fPipeController.hasPendingCommands()) {
fFreshFrame = true;
flushPendingCommands(kSilent_PlaybackMode);
- if (fNotificationClient) {
- fNotificationClient->skippedPendingDrawCommands();
- }
}
}
}
}
fPipeWriter.flushRecording(true);
fPipeController.playback(kSilent_PlaybackMode == playbackMode);
- if (playbackMode == kNormal_PlaybackMode && fNotificationClient) {
- fNotificationClient->flushedDrawCommands();
+ if (fNotificationClient) {
+ if (playbackMode == kSilent_PlaybackMode) {
+ fNotificationClient->skippedPendingDrawCommands();
+ } else {
+ fNotificationClient->flushedDrawCommands();
+ }
}
+
fPreviousStorageAllocated = storageAllocatedForRecording();
}
REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount);
}
+static void TestDeferredCanvasSilentFlush(skiatest::Reporter* reporter) {
+ SkAutoTUnref<SkSurface> surface(createSurface(0));
+ SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get()));
+
+ NotificationCounter notificationCounter;
+ canvas->setNotificationClient(¬ificationCounter);
+
+ canvas->silentFlush(); // will skip the initial clear that was recorded in createSurface
+
+ REPORTER_ASSERT(reporter, 0 == notificationCounter.fFlushedDrawCommandsCount);
+ REPORTER_ASSERT(reporter, 1 == notificationCounter.fSkippedPendingDrawCommandsCount);
+}
+
static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(100, 100));
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get()));
DEF_GPUTEST(DeferredCanvas, reporter, factory) {
TestDeferredCanvasBitmapAccess(reporter);
TestDeferredCanvasFlush(reporter);
+ TestDeferredCanvasSilentFlush(reporter);
TestDeferredCanvasFreshFrame(reporter);
TestDeferredCanvasMemoryLimit(reporter);
TestDeferredCanvasBitmapCaching(reporter);