Revert of Revert of Revert of Make drawImage a virtual on SkDevice (patchset #1 id:1 of https://codereview.chromium.org/1126273002/)
Reason for revert:
still breaking webglconformance
Original issue's description:
> Revert of Revert of Make drawImage a virtual on SkDevice (patchset #1 id:1 of https://codereview.chromium.org/1124003002/)
>
> Reason for revert:
> retry now that some fixes (onDrawImage overrides) have landed in chrome/blink
>
> Original issue's description:
> > Revert of Make drawImage a virtual on SkDevice (patchset #4 id:60001 of https://codereview.chromium.org/1122643005/)
> >
> > Reason for revert:
> > speculative to see if it unblocks DEPS roll
> >
> > Original issue's description:
> > > Make drawImage a virtual on SkDevice
> > >
> > > Now with patch for SkDeferredCanvas
> > >
> > > This reverts commit 119468b71f8f4f45657ab30ead331be665de5a57.
> > >
> > > BUG=skia:
> > >
> > > Committed: https://skia.googlesource.com/skia/+/14fe8fd3e53b5e988aac189a8bc3ed28904d85c8
> >
> > TBR=robertphillips@google.com,mtklein@google.com,reed@google.com
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/3538e3bfe2e00bc1b5b48d977fa7adff64d8c96b
>
> TBR=robertphillips@google.com,mtklein@google.com,reed@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/620ba3afe09d4173c87537040fe50c1c1895fb1a
TBR=robertphillips@google.com,mtklein@google.com,reed@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1127993004
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 7e4539a..d5cf97b 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -32,17 +32,10 @@
kSilent_PlaybackMode,
};
-static uint64_t image_area(const SkImage* image) {
- return sk_64_mul(image->width(), image->height());
-}
-
-static bool should_draw_immediately(const SkBitmap* bitmap, const SkImage* image,
- const SkPaint* paint, size_t bitmapSizeThreshold) {
+static bool should_draw_immediately(const SkBitmap* bitmap, const SkPaint* paint,
+ size_t bitmapSizeThreshold) {
if (bitmap && ((bitmap->getTexture() && !bitmap->isImmutable()) ||
- (bitmap->getSize() > bitmapSizeThreshold))) {
- return true;
- }
- if (image && (image_area(image) > bitmapSizeThreshold)) {
+ (bitmap->getSize() > bitmapSizeThreshold))) {
return true;
}
if (paint) {
@@ -209,11 +202,6 @@
void drawSprite(const SkDraw&, const SkBitmap& bitmap,
int x, int y, const SkPaint& paint) override
{SkASSERT(0);}
- void drawImage(const SkDraw&, const SkImage*, SkScalar, SkScalar, const SkPaint&) override
- {SkASSERT(0);}
- void drawImageRect(const SkDraw&, const SkImage*, const SkRect*, const SkRect&,
- const SkPaint&) override
- {SkASSERT(0);}
void drawText(const SkDraw&, const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) override
{SkASSERT(0);}
@@ -493,15 +481,11 @@
public:
AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap,
const SkPaint* paint) {
- this->init(canvas, bitmap, NULL, paint);
- }
- AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkImage* image,
- const SkPaint* paint) {
- this->init(canvas, NULL, image, paint);
+ this->init(canvas, bitmap, paint);
}
AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkPaint* paint) {
- this->init(canvas, NULL, NULL, paint);
+ this->init(canvas, NULL, paint);
}
~AutoImmediateDrawIfNeeded() {
@@ -510,10 +494,9 @@
}
}
private:
- void init(SkDeferredCanvas& canvas, const SkBitmap* bitmap, const SkImage* image,
- const SkPaint* paint) {
+ void init(SkDeferredCanvas& canvas, const SkBitmap* bitmap, const SkPaint* paint) {
if (canvas.isDeferredDrawing() &&
- should_draw_immediately(bitmap, image, paint, canvas.getBitmapSizeThreshold())) {
+ should_draw_immediately(bitmap, paint, canvas.getBitmapSizeThreshold())) {
canvas.setDeferredDrawing(false);
fCanvas = &canvas;
} else {
@@ -853,34 +836,6 @@
this->recordedDrawCommand();
}
-
-void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
- const SkPaint* paint) {
- SkRect bounds = SkRect::MakeXYWH(x, y,
- SkIntToScalar(image->width()), SkIntToScalar(image->height()));
- if (fDeferredDrawing &&
- this->isFullFrame(&bounds, paint) &&
- isPaintOpaque(paint, image)) {
- this->getDeferredDevice()->skipPendingCommands();
- }
-
- AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
- this->drawingCanvas()->drawImage(image, x, y, paint);
- this->recordedDrawCommand();
-}
-void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
- const SkPaint* paint) {
- if (fDeferredDrawing &&
- this->isFullFrame(&dst, paint) &&
- isPaintOpaque(paint, image)) {
- this->getDeferredDevice()->skipPendingCommands();
- }
-
- AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
- this->drawingCanvas()->drawImageRect(image, src, dst, paint);
- this->recordedDrawCommand();
-}
-
void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap,
const SkIRect& center, const SkRect& dst,
const SkPaint* paint) {