aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkCanvas.h3
-rw-r--r--include/utils/SkNoDrawCanvas.h5
-rw-r--r--src/core/SkLiteRecorder.cpp2
-rw-r--r--src/core/SkRecorder.cpp3
-rw-r--r--src/utils/SkDeferredCanvas.cpp3
5 files changed, 10 insertions, 6 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 06e26208ab..837b2ff92a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1530,13 +1530,10 @@ private:
friend class AutoDrawLooper;
friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
friend class SkSurface_Raster; // needs getDevice()
- friend class SkRecorder; // resetForNextPicture
- friend class SkLiteRecorder; // resetForNextPicture
friend class SkNoDrawCanvas; // InitFlags
friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProps*, InitFlags)
friend class SkPictureRecord; // predrawNotify (why does it need it? <reed>)
friend class SkPicturePlayback; // SaveFlagsToSaveLayerFlags
- friend class SkDeferredCanvas; // For use of resetForNextPicture
friend class SkOverdrawCanvas;
friend class SkRasterHandleAllocator;
diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h
index d21d678f16..7b3eaf6b18 100644
--- a/include/utils/SkNoDrawCanvas.h
+++ b/include/utils/SkNoDrawCanvas.h
@@ -28,6 +28,11 @@ public:
// TODO: investigate the users of this ctor.
SkNoDrawCanvas(const SkIRect&);
+ // Optimization to reset state to be the same as after construction.
+ void resetCanvas(int width, int height) {
+ resetForNextPicture(SkIRect::MakeWH(width, height));
+ }
+
protected:
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index c58355bea3..29de29ac5a 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -14,7 +14,7 @@ SkLiteRecorder::SkLiteRecorder()
, fDL(nullptr) {}
void SkLiteRecorder::reset(SkLiteDL* dl, const SkIRect& bounds) {
- this->resetForNextPicture(bounds);
+ this->resetCanvas(bounds.right(), bounds.bottom());
fDL = dl;
}
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 3fdc17dfbf..47e4d74909 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -54,7 +54,8 @@ void SkRecorder::reset(SkRecord* record, const SkRect& bounds,
this->forgetRecord();
fDrawPictureMode = dpm;
fRecord = record;
- this->resetForNextPicture(bounds.roundOut());
+ SkIRect rounded = bounds.roundOut();
+ this->resetCanvas(rounded.right(), rounded.bottom());
fMiniRecorder = mr;
}
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 975f496d3b..a98d4b7387 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -63,7 +63,8 @@ void SkDeferredCanvas::reset(SkCanvas* canvas) {
}
fRecs.reset();
if (canvas) {
- this->resetForNextPicture(SkIRect::MakeSize(canvas->getBaseLayerSize()));
+ this->resetCanvas(canvas->getBaseLayerSize().width(),
+ canvas->getBaseLayerSize().height());
fCanvas = canvas;
}
}