friend class SkLua; // needs top layer size and offset
friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
friend class SkSurface_Raster; // needs getDevice()
- friend class SkRecorder; // InitFlags
- friend class SkLiteRecorder; // InitFlags
- friend class SkNoDrawCanvas; // InitFlags
- friend class SkNWayCanvas; // InitFlags
+ 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 SkPipeCanvas; // InitFlags
friend class SkDeferredCanvas; // For use of resetForNextPicture
friend class SkOverdrawCanvas;
#define SkNWayCanvas_DEFINED
#include "../private/SkTDArray.h"
-#include "SkCanvas.h"
+#include "SkNoDrawCanvas.h"
-class SK_API SkNWayCanvas : public SkCanvas {
+class SK_API SkNWayCanvas : public SkNoDrawCanvas {
public:
SkNWayCanvas(int width, int height);
virtual ~SkNWayCanvas();
class Iter;
private:
- typedef SkCanvas INHERITED;
+ typedef SkNoDrawCanvas INHERITED;
};
#include "SkCanvas.h"
+struct SkIRect;
+
// SkNoDrawCanvas is a helper for SkCanvas subclasses which do not need to
// actually rasterize (e.g., analysis of the draw calls).
//
public:
SkNoDrawCanvas(int width, int height);
+ // TODO: investigate the users of this ctor.
+ SkNoDrawCanvas(const SkIRect&);
+
protected:
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;
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;
#include "SkSurface.h"
SkLiteRecorder::SkLiteRecorder()
- : SkCanvas({0,0,1,1}, SkCanvas::kConservativeRasterClip_InitFlag)
+ : INHERITED(1, 1)
, fDL(nullptr) {}
void SkLiteRecorder::reset(SkLiteDL* dl) {
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
SkDrawFilter* SkLiteRecorder::setDrawFilter(SkDrawFilter* df) {
fDL->setDrawFilter(df);
- return SkCanvas::setDrawFilter(df);
+ return this->INHERITED::setDrawFilter(df);
}
#endif
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) {
#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*);
#endif
private:
+ typedef SkNoDrawCanvas INHERITED;
+
SkLiteDL* fDL;
};
///////////////////////////////////////////////////////////////////////////////////////////////
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)
#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.)
#define SkRecorder_DEFINED
#include "SkBigPicture.h"
-#include "SkCanvas.h"
#include "SkMiniRecorder.h"
+#include "SkNoDrawCanvas.h"
#include "SkRecord.h"
#include "SkRecords.h"
#include "SkTDArray.h"
// 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
///////////////////////////////////////////////////////////////////////////////////////////////////
SkPipeCanvas::SkPipeCanvas(const SkRect& cull, SkPipeDeduper* deduper, SkWStream* stream)
- : INHERITED(cull.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
+ : INHERITED(cull.roundOut())
, fDeduper(deduper)
, fStream(stream)
{}
#ifndef SkPipeCanvas_DEFINED
#define SkPipeCanvas_DEFINED
-#include "SkCanvas.h"
#include "SkDeduper.h"
#include "SkImage.h"
+#include "SkNoDrawCanvas.h"
#include "SkPipe.h"
#include "SkTypeface.h"
#include "SkWriteBuffer.h"
};
-class SkPipeCanvas : public SkCanvas {
+class SkPipeCanvas : public SkNoDrawCanvas {
public:
SkPipeCanvas(const SkRect& cull, SkPipeDeduper*, SkWStream*);
~SkPipeCanvas() override;
friend class SkPipeWriter;
- typedef SkCanvas INHERITED;
+ typedef SkNoDrawCanvas INHERITED;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
SkDeferredCanvas::SkDeferredCanvas(SkCanvas* canvas)
- : SkCanvas({0,0,1,1}, SkCanvas::kConservativeRasterClip_InitFlag) {
+ : INHERITED(1, 1) {
this->reset(canvas);
}
#define SkDeferredCanvas_DEFINED
#include "../private/SkTDArray.h"
-#include "SkCanvas.h"
+#include "SkNoDrawCanvas.h"
-class SK_API SkDeferredCanvas : public SkCanvas {
+class SK_API SkDeferredCanvas : public SkNoDrawCanvas {
public:
SkDeferredCanvas(SkCanvas* = nullptr);
~SkDeferredCanvas() override;
void internal_flush_translate(SkScalar* x, SkScalar* y, const SkRect* boundsOrNull);
- typedef SkCanvas INHERITED;
+ typedef SkNoDrawCanvas INHERITED;
};
*/
#include "SkNWayCanvas.h"
-SkNWayCanvas::SkNWayCanvas(int width, int height)
- : INHERITED(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag) {}
+SkNWayCanvas::SkNWayCanvas(int width, int height) : INHERITED(width, height) {}
SkNWayCanvas::~SkNWayCanvas() {
this->removeAll();