aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2016-12-02 12:05:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-02 18:25:49 +0000
commit439ace939b6aaa58408ece0e9e89b633353571ae (patch)
tree52aac10a10da5ea0f5c9e3ceda21b76ed8910f05 /src/core
parenta83abcc129a2647b79c60763b098c8bccc0b947f (diff)
Rebase non-drawing SkCanvas subclasses to SkNoDrawCanvas
R=reed@google.com,mtklein@google.com Change-Id: I7df84587821db561e262a915afa23108a4a78834 Reviewed-on: https://skia-review.googlesource.com/5508 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp3
-rw-r--r--src/core/SkLiteRecorder.cpp12
-rw-r--r--src/core/SkLiteRecorder.h6
-rw-r--r--src/core/SkRecorder.cpp8
-rw-r--r--src/core/SkRecorder.h4
5 files changed, 19 insertions, 14 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 25f83deb09..2dff8e9f89 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -3373,6 +3373,9 @@ SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
SkNoDrawCanvas::SkNoDrawCanvas(int width, int height)
: INHERITED(SkIRect::MakeWH(width, height), kConservativeRasterClip_InitFlag) {}
+SkNoDrawCanvas::SkNoDrawCanvas(const SkIRect& bounds)
+ : INHERITED(bounds, kConservativeRasterClip_InitFlag) {}
+
SkCanvas::SaveLayerStrategy SkNoDrawCanvas::getSaveLayerStrategy(const SaveLayerRec& rec) {
(void)this->INHERITED::getSaveLayerStrategy(rec);
return kNoLayer_SaveLayerStrategy;
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index 866ebd0f59..b26547a462 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -10,7 +10,7 @@
#include "SkSurface.h"
SkLiteRecorder::SkLiteRecorder()
- : SkCanvas({0,0,1,1}, SkCanvas::kConservativeRasterClip_InitFlag)
+ : INHERITED(1, 1)
, fDL(nullptr) {}
void SkLiteRecorder::reset(SkLiteDL* dl) {
@@ -25,7 +25,7 @@ sk_sp<SkSurface> SkLiteRecorder::onNewSurface(const SkImageInfo&, const SkSurfac
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
SkDrawFilter* SkLiteRecorder::setDrawFilter(SkDrawFilter* df) {
fDL->setDrawFilter(df);
- return SkCanvas::setDrawFilter(df);
+ return this->INHERITED::setDrawFilter(df);
}
#endif
@@ -42,19 +42,19 @@ void SkLiteRecorder::didTranslate(SkScalar dx, SkScalar dy) { fDL->translate(dx,
void SkLiteRecorder::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle style) {
fDL->clipRect(rect, op, style==kSoft_ClipEdgeStyle);
- SkCanvas::onClipRect(rect, op, style);
+ this->INHERITED::onClipRect(rect, op, style);
}
void SkLiteRecorder::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle style) {
fDL->clipRRect(rrect, op, style==kSoft_ClipEdgeStyle);
- SkCanvas::onClipRRect(rrect, op, style);
+ this->INHERITED::onClipRRect(rrect, op, style);
}
void SkLiteRecorder::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle style) {
fDL->clipPath(path, op, style==kSoft_ClipEdgeStyle);
- SkCanvas::onClipPath(path, op, style);
+ this->INHERITED::onClipPath(path, op, style);
}
void SkLiteRecorder::onClipRegion(const SkRegion& region, ClipOp op) {
fDL->clipRegion(region, op);
- SkCanvas::onClipRegion(region, op);
+ this->INHERITED::onClipRegion(region, op);
}
void SkLiteRecorder::onDrawPaint(const SkPaint& paint) {
diff --git a/src/core/SkLiteRecorder.h b/src/core/SkLiteRecorder.h
index 4ae24564fe..4ffd132862 100644
--- a/src/core/SkLiteRecorder.h
+++ b/src/core/SkLiteRecorder.h
@@ -8,11 +8,11 @@
#ifndef SkLiteRecorder_DEFINED
#define SkLiteRecorder_DEFINED
-#include "SkCanvas.h"
+#include "SkNoDrawCanvas.h"
class SkLiteDL;
-class SkLiteRecorder final : public SkCanvas {
+class SkLiteRecorder final : public SkNoDrawCanvas {
public:
SkLiteRecorder();
void reset(SkLiteDL*);
@@ -90,6 +90,8 @@ public:
#endif
private:
+ typedef SkNoDrawCanvas INHERITED;
+
SkLiteDL* fDL;
};
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 91236c6a1f..4c56d99f45 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -37,14 +37,14 @@ void SkDrawableList::append(SkDrawable* drawable) {
///////////////////////////////////////////////////////////////////////////////////////////////
SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
- : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
+ : SkNoDrawCanvas(width, height)
, fDrawPictureMode(Record_DrawPictureMode)
, fApproxBytesUsedBySubPictures(0)
, fRecord(record)
, fMiniRecorder(mr) {}
SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
- : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
+ : SkNoDrawCanvas(bounds.roundOut())
, fDrawPictureMode(Record_DrawPictureMode)
, fApproxBytesUsedBySubPictures(0)
, fRecord(record)
@@ -75,8 +75,8 @@ void SkRecorder::forgetRecord() {
#define TRY_MINIRECORDER(method, ...) \
if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
-// For methods which must call back into SkCanvas.
-#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
+// For methods which must call back into SkNoDrawCanvas.
+#define INHERITED(method, ...) this->SkNoDrawCanvas::method(__VA_ARGS__)
// Use copy() only for optional arguments, to be copied if present or skipped if not.
// (For most types we just pass by value and let copy constructors do their thing.)
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 0f157b51d8..c93ee63430 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -9,8 +9,8 @@
#define SkRecorder_DEFINED
#include "SkBigPicture.h"
-#include "SkCanvas.h"
#include "SkMiniRecorder.h"
+#include "SkNoDrawCanvas.h"
#include "SkRecord.h"
#include "SkRecords.h"
#include "SkTDArray.h"
@@ -36,7 +36,7 @@ private:
// SkRecorder provides an SkCanvas interface for recording into an SkRecord.
-class SkRecorder : public SkCanvas {
+class SkRecorder final : public SkNoDrawCanvas {
public:
// Does not take ownership of the SkRecord.
SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); // legacy version