aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/SkDeferredCanvas.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index b46e92a4a0..cce5dde538 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -526,6 +526,8 @@ SkDeferredCanvas::SkDeferredCanvas(SkDeferredDevice* device) : SkCanvas (device)
void SkDeferredCanvas::init() {
fBitmapSizeThreshold = kDeferredCanvasBitmapSizeThreshold;
fDeferredDrawing = true; // On by default
+ fCachedCanvasSize.setEmpty();
+ fCachedCanvasSizeDirty = true;
}
void SkDeferredCanvas::setMaxRecordingStorage(size_t maxStorage) {
@@ -589,6 +591,14 @@ bool SkDeferredCanvas::isFreshFrame() const {
return this->getDeferredDevice()->isFreshFrame();
}
+SkISize SkDeferredCanvas::getCanvasSize() const {
+ if (fCachedCanvasSizeDirty) {
+ fCachedCanvasSize = this->getBaseLayerSize();
+ fCachedCanvasSizeDirty = false;
+ }
+ return fCachedCanvasSize;
+}
+
bool SkDeferredCanvas::hasPendingCommands() const {
return this->getDeferredDevice()->hasPendingCommands();
}
@@ -609,6 +619,7 @@ SkSurface* SkDeferredCanvas::setSurface(SkSurface* surface) {
// all pending commands, which can help to seamlessly recover from
// a lost accelerated graphics context.
deferredDevice->setSurface(surface);
+ fCachedCanvasSizeDirty = true;
return surface;
}
@@ -632,7 +643,7 @@ SkImage* SkDeferredCanvas::newImageSnapshot() {
bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
const SkPaint* paint) const {
SkCanvas* canvas = this->drawingCanvas();
- SkISize canvasSize = this->getDeviceSize();
+ SkISize canvasSize = this->getCanvasSize();
if (rect) {
if (!canvas->getTotalMatrix().rectStaysRect()) {
return false; // conservative