Do not playback pending commands for full deferred canvas writePixels
Do not playback pending commands for full deferred canvas writePixels.
Changes the test to catch cases where discard is done without
a snapshot.
Review URL: https://codereview.chromium.org/939103002
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 647105d..5b3b58c 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -442,11 +442,11 @@
SkASSERT(x + info.width() <= width());
SkASSERT(y + info.height() <= height());
- this->flushPendingCommands(kNormal_PlaybackMode);
-
const SkImageInfo deviceInfo = this->imageInfo();
if (info.width() == deviceInfo.width() && info.height() == deviceInfo.height()) {
this->skipPendingCommands();
+ } else {
+ this->flushPendingCommands(kNormal_PlaybackMode);
}
this->prepareForImmediatePixelWrite();