Skip to content

Commit

Permalink
Guard SkCanvas bitmap virtuals for deprecation and removal (flutter#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
brianosman authored Mar 27, 2020
1 parent 2bb4177 commit 662e780
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shell/common/canvas_spy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ void DidDrawCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
MarkDrawIfNonTransparentPaint(paint);
}

#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
void DidDrawCanvas::onDrawBitmap(const SkBitmap& bitmap,
SkScalar x,
SkScalar y,
Expand All @@ -138,6 +139,7 @@ void DidDrawCanvas::onDrawBitmapRect(const SkBitmap& bitmap,
SrcRectConstraint constraint) {
did_draw_ = true;
}
#endif

void DidDrawCanvas::onDrawImage(const SkImage* image,
SkScalar left,
Expand Down
2 changes: 2 additions & 0 deletions shell/common/canvas_spy.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class DidDrawCanvas final : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
// |SkCanvasVirtualEnforcer<SkNoDrawCanvas>|
void onDrawPath(const SkPath&, const SkPaint&) override;

#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
// |SkCanvasVirtualEnforcer<SkNoDrawCanvas>|
void onDrawBitmap(const SkBitmap&,
SkScalar left,
Expand All @@ -139,6 +140,7 @@ class DidDrawCanvas final : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
const SkRect& dst,
const SkPaint*,
SrcRectConstraint) override;
#endif

// |SkCanvasVirtualEnforcer<SkNoDrawCanvas>|
void onDrawImage(const SkImage*,
Expand Down
4 changes: 4 additions & 0 deletions testing/mock_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,14 @@ void MockCanvas::onDrawRRect(const SkRRect&, const SkPaint&) {
FML_DCHECK(false);
}

#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
void MockCanvas::onDrawBitmap(const SkBitmap&,
SkScalar,
SkScalar,
const SkPaint*) {
FML_DCHECK(false);
}
#endif

void MockCanvas::onDrawImage(const SkImage*,
SkScalar,
Expand All @@ -239,13 +241,15 @@ void MockCanvas::onDrawImage(const SkImage*,
FML_DCHECK(false);
}

#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
void MockCanvas::onDrawBitmapRect(const SkBitmap&,
const SkRect*,
const SkRect&,
const SkPaint*,
SrcRectConstraint) {
FML_DCHECK(false);
}
#endif

void MockCanvas::onDrawImageRect(const SkImage*,
const SkRect*,
Expand Down
4 changes: 4 additions & 0 deletions testing/mock_canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ class MockCanvas : public SkCanvasVirtualEnforcer<SkCanvas> {
bool,
const SkPaint&) override;
void onDrawRRect(const SkRRect&, const SkPaint&) override;
#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
void onDrawBitmapRect(const SkBitmap&,
const SkRect*,
const SkRect&,
const SkPaint*,
SrcRectConstraint) override;
#endif
void onDrawImage(const SkImage* image,
SkScalar x,
SkScalar y,
Expand All @@ -213,10 +215,12 @@ class MockCanvas : public SkCanvasVirtualEnforcer<SkCanvas> {
const SkIRect&,
const SkRect&,
const SkPaint*) override;
#if defined(SK_SUPPORT_LEGACY_ONDRAWBITMAP_VIRTUALS)
void onDrawBitmap(const SkBitmap& bitmap,
SkScalar x,
SkScalar y,
const SkPaint* paint) override;
#endif
void onDrawImageLattice(const SkImage*,
const Lattice&,
const SkRect&,
Expand Down

0 comments on commit 662e780

Please sign in to comment.