From 4657ce2324ea197507c4ba728d81138f56da13b1 Mon Sep 17 00:00:00 2001 From: reed Date: Wed, 16 Dec 2015 07:52:46 -0800 Subject: [PATCH] remove drawSprite from canvas BUG=skia: Review URL: https://codereview.chromium.org/1534443003 --- bench/ImageBench.cpp | 114 -------------- gm/dropshadowimagefilter.cpp | 25 +-- gm/imagefiltersbase.cpp | 21 --- gm/imagefilterscropped.cpp | 25 +-- gm/spritebitmap.cpp | 186 +---------------------- include/core/SkCanvas.h | 17 +-- include/private/SkRecords.h | 6 - include/utils/SkDumpCanvas.h | 1 - include/utils/SkLuaCanvas.h | 1 - include/utils/SkNWayCanvas.h | 1 - include/utils/SkPaintFilterCanvas.h | 1 - src/core/SkCanvas.cpp | 37 +---- src/core/SkPicturePlayback.cpp | 10 +- src/core/SkPictureRecord.cpp | 13 -- src/core/SkPictureRecord.h | 1 - src/core/SkRecordDraw.cpp | 9 -- src/core/SkRecorder.cpp | 4 - src/core/SkRecorder.h | 1 - src/pipe/SkGPipePriv.h | 1 - src/pipe/SkGPipeRead.cpp | 12 -- src/pipe/SkGPipeWrite.cpp | 11 -- src/utils/SkDumpCanvas.cpp | 7 - src/utils/SkLuaCanvas.cpp | 7 - src/utils/SkNWayCanvas.cpp | 7 - src/utils/SkPaintFilterCanvas.cpp | 6 - src/utils/android/SkAndroidSDKCanvas.cpp | 7 - src/utils/android/SkAndroidSDKCanvas.h | 2 - src/utils/debugger/SkDebugCanvas.cpp | 4 - src/utils/debugger/SkDebugCanvas.h | 1 - src/utils/debugger/SkDrawCommand.cpp | 31 ---- src/utils/debugger/SkDrawCommand.h | 16 -- tests/ImageFilterTest.cpp | 10 +- tests/PictureTest.cpp | 2 +- tests/SurfaceTest.cpp | 1 - 34 files changed, 23 insertions(+), 575 deletions(-) diff --git a/bench/ImageBench.cpp b/bench/ImageBench.cpp index 40de28121f..097ed91d5d 100644 --- a/bench/ImageBench.cpp +++ b/bench/ImageBench.cpp @@ -62,117 +62,3 @@ private: typedef Benchmark INHERITED; }; DEF_BENCH( return new Image2RasterBench; ) - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "SkOffsetImageFilter.h" - -#if SK_SUPPORT_GPU -#include "SkGrPixelRef.h" -#endif - -enum MyDrawType { - kSprite_Type, - kBitmap_Type, - kImage_Type, -}; - -/* - * Want to time drawing images/bitmaps via drawSprite, and via drawBitmap/drawImage but with - * a non-scaling matrix and a clip that is tight to the image bounds. In this scenario, we - * should be able to match the speed of drawSprite. - * - * An optimal result should be that all three types: sprite/bitmap/image draw at the same speed. - */ -class ImageFilterSpriteBench : public Benchmark { - SkAutoTUnref fImage; - SkBitmap fBitmap; - SkString fName; - MyDrawType fType; - -public: - ImageFilterSpriteBench(MyDrawType dt, const char suffix[]) : fType(dt) { - fName.printf("image-filter-sprite-draw-%s", suffix); - } - - bool isSuitableFor(Backend backend) override { - return kGPU_Backend == backend || kRaster_Backend == backend; - } - -protected: - bool isVisual() override { - return true; - } - - const char* onGetName() override { - return fName.c_str(); - } - - void onPerCanvasPreDraw(SkCanvas* canvas) override { - const SkImageInfo info = SkImageInfo::MakeN32Premul(500, 500); - SkAutoTUnref surface(canvas->newSurface(info)); - - surface->getCanvas()->drawColor(SK_ColorRED); - fImage.reset(surface->newImageSnapshot()); - - fBitmap.setInfo(info); - if (fImage->getTexture()) { -#if SK_SUPPORT_GPU - fBitmap.setPixelRef(new SkGrPixelRef(info, fImage->getTexture()))->unref(); -#endif - } else { - SkPixmap pmap; - if (!fImage->peekPixels(&pmap)) { - sk_throw(); - } - fBitmap.installPixels(pmap); - } - } - - void onPerCanvasPostDraw(SkCanvas*) override { - // Release the image and raster surface here to prevent out of order destruction - // between these and the gpu interface. - fImage.reset(nullptr); - fBitmap.reset(); - } - - void onDraw(int loops, SkCanvas* canvas) override { - // This clip is important; it allows the drawImage/drawBitmap code to fall into the - // fast (sprite) case, since the imagefilter's output should match. - // - // When we address skbug.com/4526 we should be able to remove the need for this clip. - // - canvas->clipRect(SkRect::MakeIWH(fImage->width(), fImage->height())); - - const SkScalar kDelta = 10; - SkPaint paint; - for (int i = 0; i < loops; i++) { - for (int inner = 0; inner < 10; ++inner) { - // build the filter everytime, so we don't accidentally draw a cached version, - // since the point of this bench is to time the actual imagefilter - // handling/overhead. - SkAutoTUnref filter(SkOffsetImageFilter::Create(kDelta, kDelta)); - paint.setImageFilter(filter); - - switch (fType) { - case kSprite_Type: - canvas->drawSprite(fBitmap, 0, 0, &paint); - break; - case kBitmap_Type: - canvas->drawBitmap(fBitmap, 0, 0, &paint); - break; - case kImage_Type: - canvas->drawImage(fImage, 0, 0, &paint); - break; - } - } - } - } - -private: - typedef Benchmark INHERITED; -}; -DEF_BENCH( return new ImageFilterSpriteBench(kSprite_Type, "sprite"); ) -DEF_BENCH( return new ImageFilterSpriteBench(kBitmap_Type, "bitmap"); ) -DEF_BENCH( return new ImageFilterSpriteBench(kImage_Type, "image"); ) - diff --git a/gm/dropshadowimagefilter.cpp b/gm/dropshadowimagefilter.cpp index 81824ab797..512c82de01 100644 --- a/gm/dropshadowimagefilter.cpp +++ b/gm/dropshadowimagefilter.cpp @@ -67,29 +67,6 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { canvas->restore(); } -static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { - SkPaint paint; - - SkIRect bounds; - r.roundOut(&bounds); - - SkBitmap bm; - bm.allocN32Pixels(bounds.width(), bounds.height()); - bm.eraseColor(SK_ColorRED); - SkCanvas c(bm); - - SkIRect cropRect = SkIRect::MakeXYWH(10, 10, 44, 44); - paint.setColor(SK_ColorGREEN); - c.drawRect(SkRect::Make(cropRect), paint); - - paint.setImageFilter(imf); - SkPoint loc = { r.fLeft, r.fTop }; - canvas->getTotalMatrix().mapPoints(&loc, 1); - canvas->drawSprite(bm, - SkScalarRoundToInt(loc.fX), SkScalarRoundToInt(loc.fY), - &paint); -} - /////////////////////////////////////////////////////////////////////////////// class DropShadowImageFilterGM : public skiagm::GM { @@ -113,7 +90,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { - draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text + draw_bitmap, draw_path, draw_paint, draw_text }; SkAutoTUnref cf( diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp index 0101a9c2a0..fbe4681da4 100644 --- a/gm/imagefiltersbase.cpp +++ b/gm/imagefiltersbase.cpp @@ -165,26 +165,6 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { canvas->drawBitmap(bm, 0, 0, &paint); } -static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { - SkPaint paint; - paint.setImageFilter(imf); - - SkIRect bounds; - r.roundOut(&bounds); - - SkBitmap bm; - bm.allocN32Pixels(bounds.width(), bounds.height()); - bm.eraseColor(SK_ColorTRANSPARENT); - SkCanvas c(bm); - draw_path(&c, r, nullptr); - - SkPoint loc = { r.fLeft, r.fTop }; - canvas->getTotalMatrix().mapPoints(&loc, 1); - canvas->drawSprite(bm, - SkScalarRoundToInt(loc.fX), SkScalarRoundToInt(loc.fY), - &paint); -} - /////////////////////////////////////////////////////////////////////////////// class ImageFiltersBaseGM : public skiagm::GM { @@ -210,7 +190,6 @@ protected: draw_paint, draw_line, draw_rect, draw_path, draw_text, draw_bitmap, - draw_sprite }; SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED, diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp index 745e8984db..4c6ef62356 100644 --- a/gm/imagefilterscropped.cpp +++ b/gm/imagefilterscropped.cpp @@ -65,29 +65,6 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { canvas->drawBitmap(bm, 0, 0, &paint); } -static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { - SkPaint paint; - - SkIRect bounds; - r.roundOut(&bounds); - - SkBitmap bm; - bm.allocN32Pixels(bounds.width(), bounds.height()); - bm.eraseColor(SK_ColorRED); - SkCanvas c(bm); - - SkIRect cropRect = SkIRect::MakeXYWH(10, 10, 44, 44); - paint.setColor(SK_ColorGREEN); - c.drawRect(SkRect::Make(cropRect), paint); - - paint.setImageFilter(imf); - SkPoint loc = { r.fLeft, r.fTop }; - canvas->getTotalMatrix().mapPoints(&loc, 1); - canvas->drawSprite(bm, - SkScalarRoundToInt(loc.fX), SkScalarRoundToInt(loc.fY), - &paint); -} - /////////////////////////////////////////////////////////////////////////////// class ImageFiltersCroppedGM : public skiagm::GM { @@ -135,7 +112,7 @@ protected: virtual void onDraw(SkCanvas* canvas) override { void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { - draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text + draw_bitmap, draw_path, draw_paint, draw_text }; SkAutoTUnref cf( diff --git a/gm/spritebitmap.cpp b/gm/spritebitmap.cpp index b199371e89..4f221d49fc 100644 --- a/gm/spritebitmap.cpp +++ b/gm/spritebitmap.cpp @@ -22,8 +22,8 @@ static void make_bm(SkBitmap* bm) { canvas.drawCircle(50, 50, 50, paint); } -static void draw_2_bitmaps(SkCanvas* canvas, const SkBitmap& bm, bool doClip, - int dx, int dy, SkImageFilter* filter = nullptr) { +static void draw_1_bitmap(SkCanvas* canvas, const SkBitmap& bm, bool doClip, + int dx, int dy, SkImageFilter* filter = nullptr) { SkAutoCanvasRestore acr(canvas, true); SkPaint paint; @@ -35,15 +35,6 @@ static void draw_2_bitmaps(SkCanvas* canvas, const SkBitmap& bm, bool doClip, paint.setImageFilter(filter); clipR.inset(5, 5); - if (doClip) { - canvas->save(); - canvas->clipRect(clipR); - } - canvas->drawSprite(bm, dx, dy, &paint); - if (doClip) { - canvas->restore(); - } - canvas->translate(SkIntToScalar(bm.width() + 20), 0); if (doClip) { @@ -83,13 +74,13 @@ protected: SkScalar sigma = 8; SkAutoTUnref filter(SkBlurImageFilter::Create(sigma, sigma)); - draw_2_bitmaps(canvas, bm, false, dx, dy); + draw_1_bitmap(canvas, bm, false, dx, dy); dy += bm.height() + 20; - draw_2_bitmaps(canvas, bm, false, dx, dy, filter); + draw_1_bitmap(canvas, bm, false, dx, dy, filter); dy += bm.height() + 20; - draw_2_bitmaps(canvas, bm, true, dx, dy); + draw_1_bitmap(canvas, bm, true, dx, dy); dy += bm.height() + 20; - draw_2_bitmaps(canvas, bm, true, dx, dy, filter); + draw_1_bitmap(canvas, bm, true, dx, dy, filter); } private: @@ -196,22 +187,6 @@ protected: canvas->translate(spacer, 0); show_image(canvas, image2, offset2); // not snug - // Try drawing the original w/ the filter, to see that it "draws" the same as - // when we have manually applied the filter (above). - { - SkPaint paint; - paint.setImageFilter(filter); - - SkBitmap bm; - image0->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode); - SkPoint loc = { 0, 0 }; - canvas->translate(spacer, 0); - canvas->getTotalMatrix().mapPoints(&loc, 1); - canvas->drawSprite(bm, (int)loc.x(), (int)loc.y(), &paint); // like snug - - canvas->translate(spacer, 0); - canvas->drawImage(image0, 0, 0, &paint); // like not snug - } canvas->restore(); canvas->translate(0, spacer); @@ -222,152 +197,3 @@ private: typedef GM INHERITED; }; DEF_GM( return new ApplyFilterGM; ) - -////////////////////// - -#include "SkDisplacementMapEffect.h" -#include "SkMatrixConvolutionImageFilter.h" - -static SkPMColor max_component(SkPMColor a, SkPMColor b) { - int dr = SkAbs32(SkGetPackedR32(a) - SkGetPackedR32(b)); - int dg = SkAbs32(SkGetPackedG32(a) - SkGetPackedG32(b)); - int db = SkAbs32(SkGetPackedB32(a) - SkGetPackedB32(b)); - int d = SkTMax(dr, SkTMax(dg, db)); - d = 0xFF - d; - return SkPackARGB32(0xFF, d, d, d); -} - -static SkImage* compute_diff(SkImage* a, SkImage* b) { - SkASSERT(a->width() == b->width() && a->height() == b->height()); - const SkImageInfo info = SkImageInfo::MakeN32Premul(a->width(), a->height()); - SkBitmap bma, bmb, bmdiff; - bma.allocPixels(info); - bmb.allocPixels(info); - bmdiff.allocPixels(info); - - a->readPixels(info, bma.getPixels(), bma.rowBytes(), 0, 0); - b->readPixels(info, bmb.getPixels(), bmb.rowBytes(), 0, 0); - for (int y = 0; y < info.height(); ++y) { - for (int x = 0; x < info.width(); ++x) { - *bmdiff.getAddr32(x, y) = max_component(*bma.getAddr32(x, y), *bmb.getAddr32(x, y)); - } - } - bmdiff.setImmutable(); // avoid the copy - return SkImage::NewFromBitmap(bmdiff); -} - -static SkImage* make_native_red_oval(SkCanvas* rootCanvas) { - SkImageInfo info = SkImageInfo::MakeN32Premul(160, 90); - SkAutoTUnref surface(rootCanvas->newSurface(info)); - if (!surface) { - surface.reset(SkSurface::NewRaster(info)); - } - - SkPaint paint; - paint.setAntiAlias(true); - paint.setColor(SK_ColorRED); - surface->getCanvas()->drawOval(SkRect::MakeWH(160, 90), paint); - return surface->newImageSnapshot(); -} - - -static SkSurface* make_surface(SkCanvas* factory, const SkImageInfo& info) { - SkSurface* surface = factory->newSurface(info); - if (!surface) { - surface = SkSurface::NewRaster(info); - } - return surface; -} - -template SkImage* snapshot(SkCanvas* canvas, const SkImageInfo& info, - DrawProc p) { - SkAutoTUnref surface(make_surface(canvas, info)); - p(surface->getCanvas()); - return surface->newImageSnapshot(); -} - -/** - * Try drawing an image+imagefilter in two different ways - * 1. as drawSprite - * 2. as drawImage + clipped to image bounds - * The two should draw the same. To try to visualize this, we draw a 4th column of the difference - * between the two versions. If it is all black (where there is alpha), they drew the same! - */ -class DrawWithFilterGM : public skiagm::GM { -public: - DrawWithFilterGM() {} - -protected: - SkString onShortName() override { - return SkString("draw-with-filter"); - } - - SkISize onISize() override { - return SkISize::Make(780, 780); - } - - void onDraw(SkCanvas* canvas) override { - SkAutoTUnref image0(make_native_red_oval(canvas)); - SkAutoTUnref image1(make_native_red_oval(canvas)); - - const ImageFilterFactory factories[] = { - IFCCast([]{ return SkBlurImageFilter::Create(8, 8); }), - IFCCast([]{ SkAutoTUnref cf(SkModeColorFilter::Create(SK_ColorBLUE, - SkXfermode::kSrcIn_Mode)); - return SkColorFilterImageFilter::Create(cf); - }), - IFCCast([]{ return SkDilateImageFilter::Create(8, 8); }), - IFCCast([]{ return SkErodeImageFilter::Create(8, 8); }), - IFCCast([]{ return SkOffsetImageFilter::Create(8, 8); }), - - IFCCast([]{ return (SkImageFilter*)SkDisplacementMapEffect::Create( - SkDisplacementMapEffect::kR_ChannelSelectorType, - SkDisplacementMapEffect::kG_ChannelSelectorType, - 10, nullptr); }), - IFCCast([]{ - const SkScalar kernel[] = { 1, 1, 1, 1, -7, 1, 1, 1, 1 }; - return (SkImageFilter*)SkMatrixConvolutionImageFilter::Create( - SkISize::Make(3, 3), - kernel, 1, 0, - SkIPoint::Make(0, 0), - SkMatrixConvolutionImageFilter::kClamp_TileMode, - true); }), - }; - - const SkScalar dx = 180; - const SkScalar dy = 110; - const SkImageInfo info = SkImageInfo::MakeN32Premul(image0->width(), image0->height()); - - canvas->translate(20, 20); - for (auto&& factory : factories) { - SkAutoTUnref filter(factory()); - SkPaint paint; - paint.setImageFilter(filter); - - SkAutoTUnref snap0(snapshot(canvas, info, [&](SkCanvas* c) { - c->drawImage(image0, 0, 0, &paint); - })); - canvas->drawImage(snap0, 0, 0); - - SkAutoTUnref snap1(snapshot(canvas, info, [&](SkCanvas* c) { - SkBitmap bm; - image1->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode); - c->drawSprite(bm, 0, 0, &paint); - })); - canvas->drawImage(snap1, dx, 0); - - SkAutoTUnref diff(snapshot(canvas, info, [&](SkCanvas* c) { - SkAutoTUnref diff(compute_diff(snap0, snap1)); - c->drawImage(diff, 0, 0); - })); - canvas->drawImage(diff, 2*dx, 0); - - canvas->translate(0, dy); - } - } - -private: - typedef GM INHERITED; -}; -DEF_GM( return new DrawWithFilterGM; ) - diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 14f0aa5250..6be13f2a52 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -911,19 +911,6 @@ public: void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint* paint = NULL); - /** Draw the specified bitmap, with its top/left corner at (x,y), - NOT transformed by the current matrix. Note: if the paint - contains a maskfilter that generates a mask which extends beyond the - bitmap's original width/height, then the bitmap will be drawn as if it - were in a Shader with CLAMP mode. Thus the color outside of the original - width/height will be the edge color replicated. - @param bitmap The bitmap to be drawn - @param left The position of the left side of the bitmap being drawn - @param top The position of the top side of the bitmap being drawn - @param paint The paint used to draw the bitmap, or NULL - */ - void drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint = NULL); - /** Draw the text, with origin at (x,y), using the specified paint. The origin is interpreted based on the Align setting in the paint. @param text The text to be drawn @@ -1292,7 +1279,9 @@ protected: SrcRectConstraint); virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*); - virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*); +#ifdef SK_SUPPORT_LEGACY_ONDRAWSPRITE + virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) {} +#endif enum ClipEdgeStyle { kHard_ClipEdgeStyle, diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index b856647aee..ab9b8a089c 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -63,7 +63,6 @@ namespace SkRecords { M(DrawTextOnPath) \ M(DrawRRect) \ M(DrawRect) \ - M(DrawSprite) \ M(DrawTextBlob) \ M(DrawAtlas) \ M(DrawVertices) @@ -315,11 +314,6 @@ RECORD(DrawRRect, kDraw_Tag, RECORD(DrawRect, kDraw_Tag, SkPaint paint; SkRect rect); -RECORD(DrawSprite, kDraw_Tag|kHasImage_Tag, - Optional paint; - ImmutableBitmap bitmap; - int left; - int top); RECORD(DrawText, kDraw_Tag|kHasText_Tag, SkPaint paint; PODArray text; diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index b853ba686b..41395e055a 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -108,7 +108,6 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index f07af0695b..270be8a6d3 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -54,7 +54,6 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index a60836be57..02f8c35d36 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -65,7 +65,6 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h index d693758797..0ad7e251b6 100644 --- a/include/utils/SkPaintFilterCanvas.h +++ b/include/utils/SkPaintFilterCanvas.h @@ -71,7 +71,6 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 814375687a..414e94ed59 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1441,36 +1441,8 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, LOOPER_END } -void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { - if (gTreatSpriteAsBitmap) { - this->save(); - this->resetMatrix(); - this->drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y), paint); - this->restore(); - return; - } - - TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawSprite()"); - if (bitmap.drawsNothing()) { - return; - } - SkDEBUGCODE(bitmap.validate();) - - SkPaint tmp; - if (nullptr == paint) { - paint = &tmp; - } - - LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) - - while (iter.next()) { - const SkIPoint pos = { x - iter.getX(), y - iter.getY() }; - iter.fDevice->drawBitmapAsSprite(iter, bitmap, pos.x(), pos.y(), looper.paint()); - } - LOOPER_END -} - ///////////////////////////////////////////////////////////////////////////// + void SkCanvas::translate(SkScalar dx, SkScalar dy) { SkMatrix m; m.setTranslate(dx, dy); @@ -2013,13 +1985,6 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con this->onDrawBitmapNine(bitmap, center, dst, paint); } -void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) { - if (bitmap.drawsNothing()) { - return; - } - this->onDrawSprite(bitmap, left, top, paint); -} - void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkXfermode::Mode mode, const SkRect* cull, const SkPaint* paint) { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index b994071cbb..9b27a3d1e9 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -368,11 +368,11 @@ void SkPicturePlayback::handleOp(SkReader32* reader, canvas->drawRRect(rrect, paint); } break; case DRAW_SPRITE: { - const SkPaint* paint = fPictureData->getPaint(reader); - const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)); - int left = reader->readInt(); - int top = reader->readInt(); - canvas->drawSprite(bitmap, left, top, paint); + /* const SkPaint* paint = */ fPictureData->getPaint(reader); + /* const SkBitmap bitmap = */ shallow_copy(fPictureData->getBitmap(reader)); + /* int left = */ reader->readInt(); + /* int top = */ reader->readInt(); + // drawSprite removed dec-2015 } break; case DRAW_TEXT: { const SkPaint& paint = *fPictureData->getPaint(reader); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 2b56b74dad..f9ab0c93c1 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -626,19 +626,6 @@ void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce this->validate(initialOffset, size); } -void SkPictureRecord::onDrawSprite(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint) { - // op + paint index + bitmap index + left + top - size_t size = 5 * kUInt32Size; - size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); - SkASSERT(initialOffset+get_paint_offset(DRAW_SPRITE, size) == fWriter.bytesWritten()); - this->addPaintPtr(paint); - this->addBitmap(bitmap); - this->addInt(left); - this->addInt(top); - this->validate(initialOffset, size); -} - void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { // op + paint index + length + 'length' worth of chars + x + y diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 7e21fab112..3dcaa6ce4c 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -192,7 +192,6 @@ protected: const SkPaint*) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index 849e8f92b2..f512ecf015 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -111,7 +111,6 @@ DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); DRAW(DrawRect, drawRect(r.rect, r.paint)); -DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.paint)); @@ -389,14 +388,6 @@ private: Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw. - Bounds bounds(const DrawSprite& op) const { // Ignores the matrix, but respects the clip. - SkRect rect = Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height()); - if (!rect.intersect(fCurrentClipBounds)) { - return Bounds::MakeEmpty(); - } - return rect; - } - Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); } Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); } Bounds bounds(const DrawRRect& op) const { diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index d90b2c025a..c7a826f463 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -240,10 +240,6 @@ void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center, APPEND(DrawImageNine, this->copy(paint), image, center, dst); } -void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) { - APPEND(DrawSprite, this->copy(paint), bitmap, left, top); -} - void SkRecorder::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { APPEND(DrawText, diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index 92197a0a3c..6bde375db4 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -106,7 +106,6 @@ public: const SkPaint*) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h index c4217f3bf9..1820a4941a 100644 --- a/src/pipe/SkGPipePriv.h +++ b/src/pipe/SkGPipePriv.h @@ -57,7 +57,6 @@ enum DrawOps { kDrawPosTextH_DrawOp, kDrawRect_DrawOp, kDrawRRect_DrawOp, - kDrawSprite_DrawOp, kDrawText_DrawOp, kDrawTextBlob_DrawOp, kDrawTextOnPath_DrawOp, diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index 4d57a6cca9..24f3e2d1ea 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -654,17 +654,6 @@ static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader, } } -static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, - SkGPipeState* state) { - BitmapHolder holder(reader, op32, state); - bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag); - const SkIPoint* point = skip(reader); - const SkBitmap* bitmap = holder.getBitmap(); - if (state->shouldDraw()) { - canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->paint() : nullptr); - } -} - static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, SkGPipeState* state) { unsigned slot = DrawOp_unpackData(op32); unsigned flags = DrawOp_unpackFlags(op32); @@ -891,7 +880,6 @@ static const ReadProc gReadTable[] = { drawPosTextH_rp, drawRect_rp, drawRRect_rp, - drawSprite_rp, drawText_rp, drawTextBlob_rp, drawTextOnPath_rp, diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 0fccb80d0a..2cab09c9e1 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -284,7 +284,6 @@ protected: const SkPaint*) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, @@ -828,16 +827,6 @@ void SkGPipeCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center, } } -void SkGPipeCanvas::onDrawSprite(const SkBitmap& bm, int left, int top, const SkPaint* paint) { - NOTIFY_SETUP(this); - size_t opBytesNeeded = sizeof(int32_t) * 2; - - if (this->commonDrawBitmap(bm, kDrawSprite_DrawOp, 0, opBytesNeeded, paint)) { - fWriter.write32(left); - fWriter.write32(top); - } -} - bool SkGPipeCanvas::commonDrawImage(const SkImage* image, DrawOps op, unsigned flags, size_t opBytesNeeded, const SkPaint* paint) { if (fDone) { diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 8d0209d964..a5005610ae 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -397,13 +397,6 @@ void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons bs.c_str(), rs.c_str()); } -void SkDumpCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { - SkString str; - bitmap.toString(&str); - this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(), - x, y); -} - void SkDumpCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { SkString str; diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp index ada76666fe..4916decccb 100644 --- a/src/utils/SkLuaCanvas.cpp +++ b/src/utils/SkLuaCanvas.cpp @@ -245,13 +245,6 @@ void SkLuaCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const } } -void SkLuaCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { - AUTO_LUA("drawSprite"); - if (paint) { - lua.pushPaint(*paint, "paint"); - } -} - void SkLuaCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { AUTO_LUA("drawText"); diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index fb8d0ee13e..05909a33fa 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -224,13 +224,6 @@ void SkNWayCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons } } -void SkNWayCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { - Iter iter(fList); - while (iter.next()) { - iter->drawSprite(bitmap, x, y, paint); - } -} - void SkNWayCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { Iter iter(fList); diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp index dff1514acb..ce1e4b7dbf 100644 --- a/src/utils/SkPaintFilterCanvas.cpp +++ b/src/utils/SkPaintFilterCanvas.cpp @@ -110,12 +110,6 @@ void SkPaintFilterCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& ce this->INHERITED::onDrawBitmapNine(bm, center, dst, apf.paint()); } -void SkPaintFilterCanvas::onDrawSprite(const SkBitmap& bm, int left, int top, - const SkPaint* paint) { - AutoPaintFilter apf(this, kBitmap_Type, paint); - this->INHERITED::onDrawSprite(bm, left, top, apf.paint()); -} - void SkPaintFilterCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, diff --git a/src/utils/android/SkAndroidSDKCanvas.cpp b/src/utils/android/SkAndroidSDKCanvas.cpp index e6f802fc5b..9e1463d966 100644 --- a/src/utils/android/SkAndroidSDKCanvas.cpp +++ b/src/utils/android/SkAndroidSDKCanvas.cpp @@ -156,13 +156,6 @@ void SkAndroidSDKCanvas::onDrawBitmapNine(const SkBitmap& bitmap, FILTER_PTR(paint); fProxyTarget->drawBitmapNine(bitmap, center, dst, filteredPaint); } -void SkAndroidSDKCanvas::onDrawSprite(const SkBitmap& bitmap, - int left, - int top, - const SkPaint* paint) { - FILTER_PTR(paint); - fProxyTarget->drawSprite(bitmap, left, top, filteredPaint); -} void SkAndroidSDKCanvas::onDrawVertices(VertexMode vMode, int vertexCount, const SkPoint vertices[], diff --git a/src/utils/android/SkAndroidSDKCanvas.h b/src/utils/android/SkAndroidSDKCanvas.h index 08b73f144c..1605db44f6 100644 --- a/src/utils/android/SkAndroidSDKCanvas.h +++ b/src/utils/android/SkAndroidSDKCanvas.h @@ -46,8 +46,6 @@ protected: const SkPaint* paint, SkCanvas::SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint* paint) override; - void onDrawSprite(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint) override; void onDrawVertices(VertexMode vMode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xMode, const uint16_t indices[], int indexCount, diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index f163cc5470..86937392a6 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -484,10 +484,6 @@ void SkDebugCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, this->addDrawCommand(new SkDrawDRRectCommand(outer, inner, paint)); } -void SkDebugCanvas::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) { - this->addDrawCommand(new SkDrawSpriteCommand(bitmap, left, top, paint)); -} - void SkDebugCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { this->addDrawCommand(new SkDrawTextCommand(text, byteLength, x, y, paint)); diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 612ee5756f..7de2b59437 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -205,7 +205,6 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override; void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 330c2c9183..9ebb81e74a 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -48,7 +48,6 @@ const char* SkDrawCommand::GetCommandString(OpType type) { case kDrawPosTextH_OpType: return "DrawPosTextH"; case kDrawRect_OpType: return "DrawRect"; case kDrawRRect_OpType: return "DrawRRect"; - case kDrawSprite_OpType: return "DrawSprite"; case kDrawText_OpType: return "DrawText"; case kDrawTextBlob_OpType: return "DrawTextBlob"; case kDrawTextOnPath_OpType: return "DrawTextOnPath"; @@ -799,36 +798,6 @@ bool SkDrawDRRectCommand::render(SkCanvas* canvas) const { return true; } -SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint) - : INHERITED(kDrawSprite_OpType) { - fBitmap = bitmap; - fLeft = left; - fTop = top; - if (paint) { - fPaint = *paint; - fPaintPtr = &fPaint; - } else { - fPaintPtr = nullptr; - } - - fInfo.push(SkObjectParser::BitmapToString(bitmap)); - fInfo.push(SkObjectParser::IntToString(left, "Left: ")); - fInfo.push(SkObjectParser::IntToString(top, "Top: ")); - if (paint) { - fInfo.push(SkObjectParser::PaintToString(*paint)); - } -} - -void SkDrawSpriteCommand::execute(SkCanvas* canvas) const { - canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr); -} - -bool SkDrawSpriteCommand::render(SkCanvas* canvas) const { - render_bitmap(canvas, fBitmap); - return true; -} - SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) : INHERITED(kDrawText_OpType) { diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h index c7e5f008a4..9da05eeedb 100644 --- a/src/utils/debugger/SkDrawCommand.h +++ b/src/utils/debugger/SkDrawCommand.h @@ -41,7 +41,6 @@ public: kDrawPosTextH_OpType, kDrawRect_OpType, kDrawRRect_OpType, - kDrawSprite_OpType, kDrawText_OpType, kDrawTextBlob_OpType, kDrawTextOnPath_OpType, @@ -518,21 +517,6 @@ private: typedef SkDrawCommand INHERITED; }; -class SkDrawSpriteCommand : public SkDrawCommand { -public: - SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint* paint); - void execute(SkCanvas* canvas) const override; - bool render(SkCanvas* canvas) const override; -private: - SkBitmap fBitmap; - int fLeft; - int fTop; - SkPaint fPaint; - SkPaint* fPaintPtr; - - typedef SkDrawCommand INHERITED; -}; - class SkDrawVerticesCommand : public SkDrawCommand { public: SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount, diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 6a6a7a92d6..1bf8cbdb73 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -977,7 +977,7 @@ static void test_huge_blur(SkCanvas* canvas, skiatest::Reporter* reporter) { SkPaint paint; paint.setImageFilter(blur); - canvas->drawSprite(bitmap, 0, 0, &paint); + canvas->drawBitmap(bitmap, 0, 0, &paint); } DEF_TEST(HugeBlurImageFilter, reporter) { @@ -1067,7 +1067,7 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re SkPaint paint; paint.setImageFilter(xfermodeNoFg); - canvas->drawSprite(bitmap, 0, 0, &paint); + canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite uint32_t pixel; SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); @@ -1075,12 +1075,12 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); paint.setImageFilter(xfermodeNoBg); - canvas->drawSprite(bitmap, 0, 0, &paint); + canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite canvas->readPixels(info, &pixel, 4, 0, 0); REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); paint.setImageFilter(xfermodeNoFgNoBg); - canvas->drawSprite(bitmap, 0, 0, &paint); + canvas->drawBitmap(bitmap, 0, 0, &paint); // drawSprite canvas->readPixels(info, &pixel, 4, 0, 0); REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); } @@ -1128,7 +1128,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) { canvas.clear(0x0); canvas.readPixels(info, &pixel, 4, 25, 25); canvas.saveLayer(&bounds1, nullptr); - canvas.drawSprite(bitmap, 20, 20, &filterPaint); + canvas.drawBitmap(bitmap, 20, 20, &filterPaint); // drawSprite canvas.restore(); canvas.readPixels(info, &pixel, 4, 25, 25); diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index a81733e38a..45a0505773 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -1194,7 +1194,7 @@ static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRectConstraint); canvas->drawBitmapNine(bitmap, irect, rect, &paint); - canvas->drawSprite(bitmap, 1, 1); + canvas->drawBitmap(bitmap, 1, 1); // drawSprite } static void test_draw_bitmaps(SkCanvas* canvas) { diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 6859bce6bc..f0d9b17591 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -460,7 +460,6 @@ static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface) EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0)) EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr)) EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr)) - EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, nullptr)) EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testPaint)) EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoints2, \ testPaint))