diff options
-rw-r--r-- | include/utils/SkNWayCanvas.h | 9 | ||||
-rw-r--r-- | include/utils/SkNoDrawCanvas.h | 1 | ||||
-rw-r--r-- | include/utils/SkPaintFilterCanvas.h | 7 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 40 | ||||
-rw-r--r-- | src/utils/SkPaintFilterCanvas.cpp | 34 |
5 files changed, 90 insertions, 1 deletions
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index a3e567ef89..ca57e59f58 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -58,6 +58,7 @@ protected: void onDrawPaint(const SkPaint&) override; void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; void onDrawRect(const SkRect&, const SkPaint&) override; + void onDrawRegion(const SkRegion&, const SkPaint&) override; void onDrawOval(const SkRect&, const SkPaint&) override; void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; void onDrawRRect(const SkRRect&, const SkPaint&) override; @@ -68,9 +69,17 @@ protected: void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, const SkPaint*, SrcRectConstraint) override; + void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, + const SkPaint*) override; + void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, + const SkPaint*) override; + void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, + const SkPaint*) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; + void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], + int, SkBlendMode, const SkRect*, const SkPaint*) override; void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h index 7b3eaf6b18..a261e4a2fa 100644 --- a/include/utils/SkNoDrawCanvas.h +++ b/include/utils/SkNoDrawCanvas.h @@ -74,6 +74,7 @@ protected: void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {} void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkRect*, const SkPaint*) override {} + void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override {} private: typedef SkCanvas INHERITED; diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h index d6689b91bc..29727a74c9 100644 --- a/include/utils/SkPaintFilterCanvas.h +++ b/include/utils/SkPaintFilterCanvas.h @@ -69,6 +69,7 @@ protected: void onDrawRect(const SkRect&, const SkPaint&) override; void onDrawRRect(const SkRRect&, const SkPaint&) override; void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; + void onDrawRegion(const SkRegion&, const SkPaint&) override; void onDrawOval(const SkRect&, const SkPaint&) override; void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; void onDrawPath(const SkPath&, const SkPaint&) override; @@ -77,11 +78,15 @@ protected: SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; + void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, + const SkPaint*) override; void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, const SkPaint*, SrcRectConstraint) override; void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, const SkPaint*) override; + void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, + const SkPaint*) override; void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode, @@ -101,6 +106,8 @@ protected: const SkRect* cull, const SkPaint& paint) override; void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) override; + void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], + int, SkBlendMode, const SkRect*, const SkPaint*) override; // Forwarded to the wrapped canvas. sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override; diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index c612c7d7e1..c9f9768e7c 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -150,6 +150,13 @@ void SkNWayCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { } } +void SkNWayCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) { + Iter iter(fList); + while (iter.next()) { + iter->drawRegion(region, paint); + } +} + void SkNWayCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { @@ -210,6 +217,14 @@ void SkNWayCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& cente } } +void SkNWayCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint) { + Iter iter(fList); + while (iter.next()) { + iter->drawBitmapLattice(bitmap, lattice, dst, paint); + } +} + void SkNWayCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint) { Iter iter(fList); @@ -226,6 +241,22 @@ void SkNWayCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons } } +void SkNWayCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst, + const SkPaint* paint) { + Iter iter(fList); + while (iter.next()) { + iter->drawImageNine(image, center, dst, paint); + } +} + +void SkNWayCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint) { + Iter iter(fList); + while (iter.next()) { + iter->drawImageLattice(image, lattice, dst, paint); + } +} + void SkNWayCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { Iter iter(fList); @@ -306,6 +337,15 @@ void SkNWayCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4] } } +void SkNWayCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xform[], const SkRect tex[], + const SkColor colors[], int count, SkBlendMode bmode, + const SkRect* cull, const SkPaint* paint) { + Iter iter(fList); + while (iter.next()) { + iter->drawAtlas(image, xform, tex, colors, count, bmode, cull, paint); + } +} + void SkNWayCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) { Iter iter(fList); while (iter.next()) { diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp index 668ebe37a9..37a7d44bd5 100644 --- a/src/utils/SkPaintFilterCanvas.cpp +++ b/src/utils/SkPaintFilterCanvas.cpp @@ -78,6 +78,13 @@ void SkPaintFilterCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inne } } +void SkPaintFilterCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) { + AutoPaintFilter apf(this, kPath_Type, paint); + if (apf.shouldDraw()) { + this->INHERITED::onDrawRegion(region, *apf.paint()); + } +} + void SkPaintFilterCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { AutoPaintFilter apf(this, kOval_Type, paint); if (apf.shouldDraw()) { @@ -124,6 +131,14 @@ void SkPaintFilterCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& ce } } +void SkPaintFilterCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint) { + AutoPaintFilter apf(this, kBitmap_Type, paint); + if (apf.shouldDraw()) { + this->INHERITED::onDrawBitmapLattice(bitmap, lattice, dst, apf.paint()); + } +} + void SkPaintFilterCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); @@ -142,13 +157,21 @@ void SkPaintFilterCanvas::onDrawImageRect(const SkImage* image, const SkRect* sr } void SkPaintFilterCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, - const SkRect& dst, const SkPaint* paint) { + const SkRect& dst, const SkPaint* paint) { AutoPaintFilter apf(this, kBitmap_Type, paint); if (apf.shouldDraw()) { this->INHERITED::onDrawImageNine(image, center, dst, apf.paint()); } } +void SkPaintFilterCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint) { + AutoPaintFilter apf(this, kBitmap_Type, paint); + if (apf.shouldDraw()) { + this->INHERITED::onDrawImageLattice(image, lattice, dst, apf.paint()); + } +} + void SkPaintFilterCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode bmode, const SkPaint& paint) { AutoPaintFilter apf(this, kVertices_Type, paint); @@ -233,6 +256,15 @@ void SkPaintFilterCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkS } } +void SkPaintFilterCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xform[], + const SkRect tex[], const SkColor colors[], int count, + 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()); + } +} + sk_sp<SkSurface> SkPaintFilterCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) { return proxy()->makeSurface(info, &props); |