diff options
author | Brian Osman <brianosman@google.com> | 2018-03-09 13:40:31 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-09 19:43:41 +0000 |
commit | 37886ce8cd7ff7ab9ac7f6440bd31abfd39955e5 (patch) | |
tree | ef2f462295f5f214e75bf431d2aede181e8d31aa /src/utils | |
parent | e5daecd5c3d6a62cff065266cc40e5373bc5a473 (diff) |
Shim to enforce that canvas virtuals are overridden
Change-Id: Iad70d449bbc43195baefd70d20c41996a8435e6e
Reviewed-on: https://skia-review.googlesource.com/113320
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkPaintFilterCanvas.cpp | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp index 37a7d44bd5..c17990d536 100644 --- a/src/utils/SkPaintFilterCanvas.cpp +++ b/src/utils/SkPaintFilterCanvas.cpp @@ -32,7 +32,8 @@ private: }; SkPaintFilterCanvas::SkPaintFilterCanvas(SkCanvas *canvas) - : INHERITED(canvas->imageInfo().width(), canvas->imageInfo().height()) { + : SkCanvasVirtualEnforcer<SkNWayCanvas>(canvas->imageInfo().width(), + canvas->imageInfo().height()) { // Transfer matrix & clip state before adding the target canvas. this->clipRect(SkRect::Make(canvas->getDeviceClipBounds())); @@ -44,7 +45,7 @@ SkPaintFilterCanvas::SkPaintFilterCanvas(SkCanvas *canvas) void SkPaintFilterCanvas::onDrawPaint(const SkPaint& paint) { AutoPaintFilter apf(this, kPaint_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPaint(*apf.paint()); + this->SkNWayCanvas::onDrawPaint(*apf.paint()); } } @@ -52,21 +53,21 @@ void SkPaintFilterCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoi const SkPaint& paint) { AutoPaintFilter apf(this, kPoint_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPoints(mode, count, pts, *apf.paint()); + this->SkNWayCanvas::onDrawPoints(mode, count, pts, *apf.paint()); } } void SkPaintFilterCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { AutoPaintFilter apf(this, kRect_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawRect(rect, *apf.paint()); + this->SkNWayCanvas::onDrawRect(rect, *apf.paint()); } } void SkPaintFilterCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { AutoPaintFilter apf(this, kRRect_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawRRect(rrect, *apf.paint()); + this->SkNWayCanvas::onDrawRRect(rrect, *apf.paint()); } } @@ -74,21 +75,21 @@ void SkPaintFilterCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inne const SkPaint& paint) { AutoPaintFilter apf(this, kDRRect_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawDRRect(outer, inner, *apf.paint()); + this->SkNWayCanvas::onDrawDRRect(outer, inner, *apf.paint()); } } void SkPaintFilterCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) { AutoPaintFilter apf(this, kPath_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawRegion(region, *apf.paint()); + this->SkNWayCanvas::onDrawRegion(region, *apf.paint()); } } void SkPaintFilterCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { AutoPaintFilter apf(this, kOval_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawOval(rect, *apf.paint()); + this->SkNWayCanvas::onDrawOval(rect, *apf.paint()); } } @@ -96,14 +97,14 @@ void SkPaintFilterCanvas::onDrawArc(const SkRect& rect, SkScalar startAngle, SkS bool useCenter, const SkPaint& paint) { AutoPaintFilter apf(this, kArc_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawArc(rect, startAngle, sweepAngle, useCenter, *apf.paint()); + this->SkNWayCanvas::onDrawArc(rect, startAngle, sweepAngle, useCenter, *apf.paint()); } } void SkPaintFilterCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { AutoPaintFilter apf(this, kPath_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPath(path, *apf.paint()); + this->SkNWayCanvas::onDrawPath(path, *apf.paint()); } } @@ -111,7 +112,7 @@ void SkPaintFilterCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScal const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawBitmap(bm, left, top, apf.paint()); + this->SkNWayCanvas::onDrawBitmap(bm, left, top, apf.paint()); } } @@ -119,7 +120,7 @@ void SkPaintFilterCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src const SkPaint* paint, SrcRectConstraint constraint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawBitmapRect(bm, src, dst, apf.paint(), constraint); + this->SkNWayCanvas::onDrawBitmapRect(bm, src, dst, apf.paint(), constraint); } } @@ -127,7 +128,7 @@ void SkPaintFilterCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& ce const SkRect& dst, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawBitmapNine(bm, center, dst, apf.paint()); + this->SkNWayCanvas::onDrawBitmapNine(bm, center, dst, apf.paint()); } } @@ -135,7 +136,7 @@ void SkPaintFilterCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Latt const SkRect& dst, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawBitmapLattice(bitmap, lattice, dst, apf.paint()); + this->SkNWayCanvas::onDrawBitmapLattice(bitmap, lattice, dst, apf.paint()); } } @@ -143,7 +144,7 @@ void SkPaintFilterCanvas::onDrawImage(const SkImage* image, SkScalar left, SkSca const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawImage(image, left, top, apf.paint()); + this->SkNWayCanvas::onDrawImage(image, left, top, apf.paint()); } } @@ -152,7 +153,7 @@ void SkPaintFilterCanvas::onDrawImageRect(const SkImage* image, const SkRect* sr SrcRectConstraint constraint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawImageRect(image, src, dst, apf.paint(), constraint); + this->SkNWayCanvas::onDrawImageRect(image, src, dst, apf.paint(), constraint); } } @@ -160,7 +161,7 @@ void SkPaintFilterCanvas::onDrawImageNine(const SkImage* image, const SkIRect& c const SkRect& dst, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawImageNine(image, center, dst, apf.paint()); + this->SkNWayCanvas::onDrawImageNine(image, center, dst, apf.paint()); } } @@ -168,7 +169,7 @@ void SkPaintFilterCanvas::onDrawImageLattice(const SkImage* image, const Lattice const SkRect& dst, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawImageLattice(image, lattice, dst, apf.paint()); + this->SkNWayCanvas::onDrawImageLattice(image, lattice, dst, apf.paint()); } } @@ -176,7 +177,7 @@ void SkPaintFilterCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBle const SkPaint& paint) { AutoPaintFilter apf(this, kVertices_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawVerticesObject(vertices, bmode, *apf.paint()); + this->SkNWayCanvas::onDrawVerticesObject(vertices, bmode, *apf.paint()); } } @@ -185,7 +186,7 @@ void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[], const SkColor colo const SkPaint& paint) { AutoPaintFilter apf(this, kPatch_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPatch(cubics, colors, texCoords, bmode, *apf.paint()); + this->SkNWayCanvas::onDrawPatch(cubics, colors, texCoords, bmode, *apf.paint()); } } @@ -193,7 +194,7 @@ void SkPaintFilterCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix const SkPaint* paint) { AutoPaintFilter apf(this, kPicture_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPicture(picture, m, apf.paint()); + this->SkNWayCanvas::onDrawPicture(picture, m, apf.paint()); } } @@ -203,7 +204,7 @@ void SkPaintFilterCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* m // order to actually filter nested content. AutoPaintFilter apf(this, kDrawable_Type, nullptr); if (apf.shouldDraw()) { - this->INHERITED::onDrawDrawable(drawable, matrix); + this->SkNWayCanvas::onDrawDrawable(drawable, matrix); } } @@ -211,7 +212,7 @@ void SkPaintFilterCanvas::onDrawText(const void* text, size_t byteLength, SkScal const SkPaint& paint) { AutoPaintFilter apf(this, kText_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawText(text, byteLength, x, y, *apf.paint()); + this->SkNWayCanvas::onDrawText(text, byteLength, x, y, *apf.paint()); } } @@ -219,7 +220,7 @@ void SkPaintFilterCanvas::onDrawPosText(const void* text, size_t byteLength, con const SkPaint& paint) { AutoPaintFilter apf(this, kText_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPosText(text, byteLength, pos, *apf.paint()); + this->SkNWayCanvas::onDrawPosText(text, byteLength, pos, *apf.paint()); } } @@ -227,7 +228,7 @@ void SkPaintFilterCanvas::onDrawPosTextH(const void* text, size_t byteLength, co SkScalar constY, const SkPaint& paint) { AutoPaintFilter apf(this, kText_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawPosTextH(text, byteLength, xpos, constY, *apf.paint()); + this->SkNWayCanvas::onDrawPosTextH(text, byteLength, xpos, constY, *apf.paint()); } } @@ -235,7 +236,7 @@ void SkPaintFilterCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkMatrix* matrix, const SkPaint& paint) { AutoPaintFilter apf(this, kText_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawTextOnPath(text, byteLength, path, matrix, *apf.paint()); + this->SkNWayCanvas::onDrawTextOnPath(text, byteLength, path, matrix, *apf.paint()); } } @@ -244,7 +245,7 @@ void SkPaintFilterCanvas::onDrawTextRSXform(const void* text, size_t byteLength, const SkPaint& paint) { AutoPaintFilter apf(this, kText_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawTextRSXform(text, byteLength, xform, cull, *apf.paint()); + this->SkNWayCanvas::onDrawTextRSXform(text, byteLength, xform, cull, *apf.paint()); } } @@ -252,7 +253,7 @@ void SkPaintFilterCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkS const SkPaint& paint) { AutoPaintFilter apf(this, kTextBlob_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawTextBlob(blob, x, y, *apf.paint()); + this->SkNWayCanvas::onDrawTextBlob(blob, x, y, *apf.paint()); } } @@ -261,10 +262,18 @@ void SkPaintFilterCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xfor SkBlendMode bmode, const SkRect* cull, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { - this->INHERITED::onDrawAtlas(image, xform, tex, colors, count, bmode, cull, apf.paint()); + this->SkNWayCanvas::onDrawAtlas(image, xform, tex, colors, count, bmode, cull, apf.paint()); } } +void SkPaintFilterCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) { + this->SkNWayCanvas::onDrawAnnotation(rect, key, value); +} + +void SkPaintFilterCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) { + this->SkNWayCanvas::onDrawShadowRec(path, rec); +} + sk_sp<SkSurface> SkPaintFilterCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) { return proxy()->makeSurface(info, &props); |