Reland of move drawSprite from canvas (patchset #1 id:1 of https://codereview.chromiu...
authorreed <reed@google.com>
Wed, 16 Dec 2015 16:38:15 +0000 (08:38 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 16 Dec 2015 16:38:16 +0000 (08:38 -0800)
Reason for revert:
guard has landed in chrome

Original issue's description:
> Revert of remove drawSprite from canvas (patchset #4 id:60001 of https://codereview.chromium.org/1534443003/ )
>
> Reason for revert:
> need to remove an override in chrome
>
> Original issue's description:
> > remove drawSprite from canvas
> >
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/4657ce2324ea197507c4ba728d81138f56da13b1
>
> TBR=fmalita@chromium.org,robertphillips@google.com,senorblanco@chromium.org,mtklein@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/32704674f64cb6a14356dfebe060cd3484c06cc7

TBR=fmalita@chromium.org,robertphillips@google.com,senorblanco@chromium.org,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1530203002

34 files changed:
bench/ImageBench.cpp
gm/dropshadowimagefilter.cpp
gm/imagefiltersbase.cpp
gm/imagefilterscropped.cpp
gm/spritebitmap.cpp
include/core/SkCanvas.h
include/private/SkRecords.h
include/utils/SkDumpCanvas.h
include/utils/SkLuaCanvas.h
include/utils/SkNWayCanvas.h
include/utils/SkPaintFilterCanvas.h
src/core/SkCanvas.cpp
src/core/SkPicturePlayback.cpp
src/core/SkPictureRecord.cpp
src/core/SkPictureRecord.h
src/core/SkRecordDraw.cpp
src/core/SkRecorder.cpp
src/core/SkRecorder.h
src/pipe/SkGPipePriv.h
src/pipe/SkGPipeRead.cpp
src/pipe/SkGPipeWrite.cpp
src/utils/SkDumpCanvas.cpp
src/utils/SkLuaCanvas.cpp
src/utils/SkNWayCanvas.cpp
src/utils/SkPaintFilterCanvas.cpp
src/utils/android/SkAndroidSDKCanvas.cpp
src/utils/android/SkAndroidSDKCanvas.h
src/utils/debugger/SkDebugCanvas.cpp
src/utils/debugger/SkDebugCanvas.h
src/utils/debugger/SkDrawCommand.cpp
src/utils/debugger/SkDrawCommand.h
tests/ImageFilterTest.cpp
tests/PictureTest.cpp
tests/SurfaceTest.cpp

index 40de28121fb5d6695902200bb5518a37cccf3eae..097ed91d5de45f36d6d07fd4428693184a46067e 100644 (file)
@@ -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<SkImage>       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<SkSurface> 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<SkImageFilter> 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"); )
-
index 81824ab7977cf5cfc69e90b38e2136dd650f0b59..512c82de01da27f08ca436a99934927148c5dfcf 100644 (file)
@@ -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<SkColorFilter> cf(
index 0101a9c2a042816f2237874ccf1a15da4ea7f2b4..fbe4681da4276af5aa3a9616649dda78f4e033c1 100644 (file)
@@ -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,
index 745e8984dbdc2b7947770f7bd955f6a4a61fd7ed..4c6ef623561a450834afb2600f1b9f37d50f09b0 100644 (file)
@@ -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<SkColorFilter> cf(
index b199371e89a2e0d35b67446ffe303d763d4bde10..4f221d49fc71d808d0d932bb30d4973b174f4d52 100644 (file)
@@ -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<SkImageFilter> 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<SkSurface> 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 <typename DrawProc> SkImage* snapshot(SkCanvas* canvas, const SkImageInfo& info,
-                                               DrawProc p) {
-    SkAutoTUnref<SkSurface> 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<SkImage> image0(make_native_red_oval(canvas));
-        SkAutoTUnref<SkImage> image1(make_native_red_oval(canvas));
-
-        const ImageFilterFactory factories[] = {
-            IFCCast([]{ return SkBlurImageFilter::Create(8, 8); }),
-            IFCCast([]{ SkAutoTUnref<SkColorFilter> 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<SkImageFilter> filter(factory());
-            SkPaint paint;
-            paint.setImageFilter(filter);
-
-            SkAutoTUnref<SkImage> snap0(snapshot(canvas, info, [&](SkCanvas* c) {
-                c->drawImage(image0, 0, 0, &paint);
-            }));
-            canvas->drawImage(snap0, 0, 0);
-
-            SkAutoTUnref<SkImage> 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<SkImage> diff(snapshot(canvas, info, [&](SkCanvas* c) {
-                SkAutoTUnref<SkImage> 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; )
-
index 14f0aa5250920aded9f78b9a541e2b2857cd454b..6be13f2a5278a1b2b3cf6ba3766bb3249796b759 100644 (file)
@@ -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,
index b856647aeed55099f636200afa260181a4f87a1e..ab9b8a089cc84476f2888dc9f6e0766ccb581b38 100644 (file)
@@ -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<SkPaint> paint;
-        ImmutableBitmap bitmap;
-        int left;
-        int top);
 RECORD(DrawText, kDraw_Tag|kHasText_Tag,
         SkPaint paint;
         PODArray<char> text;
index b853ba686b0fa97ccbd52aa1077f3e291cd3568a..41395e055ac82bc55a89e14c01bdf4e29d9f1f8a 100644 (file)
@@ -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,
index f07af0695bf9b78c5d7ac7cf2dcd22d5350098f5..270be8a6d3eecfa2381c9c3c1952380150a15361 100644 (file)
@@ -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,
index a60836be5743222cf4f9701fb5ec60427808ffca..02f8c35d368282b1c00af86b21cc9ee27c1811a5 100644 (file)
@@ -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,
index d693758797ce624f29c5c613c672482d486fd74e..0ad7e251b6e54759a850a9c6c04fbbba4d7362db 100644 (file)
@@ -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,
index 814375687a743b7a897a88a2a6ce2f1682075359..414e94ed59acc76eb562d33a7a7e2791e7249b95 100644 (file)
@@ -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) {
index b994071cbb4b0ad9d021aaf41524a0b7f2890c03..9b27a3d1e91067b2368a1b664dc0430c1799a183 100644 (file)
@@ -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);
index 2b56b74dad844a6daa1ef647b1ece40bdd0f2705..f9ab0c93c16db6d7356b348b35123a165ad12d50 100644 (file)
@@ -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
index 7e21fab1120892f1fc6775af9e8801cfaaf8ea9e..3dcaa6ce4c5dda548a5f3dd1a1da5df954b8ec3e 100644 (file)
@@ -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,
index 849e8f92b249aa422cb3b538b6f06f2a10d9d2c1..f512ecf0154c01eaffec3d6219ecfd91ff3fe126 100644 (file)
@@ -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 {
index d90b2c025ac0635f526cd0543c7118441c093b9b..c7a826f463adc3d7ca9e8497ac3873b6522d103f 100644 (file)
@@ -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,
index 92197a0a3c613a7206cc6e98b4dd3a5774e91764..6bde375db4f1b3bfc0a79a48499f4d11b5d3d70b 100644 (file)
@@ -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,
index c4217f3bf9c4b875dd389954be08619e9e61d24f..1820a4941aee9521489d6349897834a714512220 100644 (file)
@@ -57,7 +57,6 @@ enum DrawOps {
     kDrawPosTextH_DrawOp,
     kDrawRect_DrawOp,
     kDrawRRect_DrawOp,
-    kDrawSprite_DrawOp,
     kDrawText_DrawOp,
     kDrawTextBlob_DrawOp,
     kDrawTextOnPath_DrawOp,
index 4d57a6cca9db0896249b825ff03af0bb70f2418f..24f3e2d1eabe933083f023341716a4e255c41aee 100644 (file)
@@ -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<SkIPoint>(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,
index 0fccb80d0a1680f07bd0dafba53d2d76a00e4492..2cab09c9e1b7220b3967667a47ae56279a2288c8 100644 (file)
@@ -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) {
index 8d0209d96422249bac2a51faa82fd4b391368b3e..a5005610ae0fecf402084b2d14056dd339f87b20 100644 (file)
@@ -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;
index ada76666fe506b5c61c1e9ee4ed1964019e40129..4916decccb684b5df8c27e5b771feaefcb7e6289 100644 (file)
@@ -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");
index fb8d0ee13eb7fad025889140e13ecb2a1c625526..05909a33fa9aa52cd557b174d7289501b10de8df 100644 (file)
@@ -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);
index dff1514acbfc7fb3f959ac63b8bfd2efb191c99b..ce1e4b7dbf2134f2ae5663c483c85ece9fe2adb3 100644 (file)
@@ -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,
index e6f802fc5ba6ce8bd3b23beb947113473a376f85..9e1463d9668733b0b3184867d79754f4f12a1978 100644 (file)
@@ -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[],
index 08b73f144cdf19c230a14569afbdaf96b2a171ea..1605db44f62113e3b9032da1f58f3a985797e392 100644 (file)
@@ -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,
index f163cc5470be046c35c01aeccdc9875bf4c4c71d..86937392a6afc5ec44a74a2c5f18e3907bd75b82 100644 (file)
@@ -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));
index 612ee5756f982c14f45d54cb44bc7b2a6f58dc2b..7de2b59437c8c8321a1bea03f35dbc61a02caa8f 100644 (file)
@@ -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;
index 330c2c9183cecf156a995c0b0b4d2feddeeb8190..9ebb81e74ae63d94c97a809b613173398c8c101c 100644 (file)
@@ -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) {
index c7e5f008a423b4e4c1911bdc72dbd461292c7060..9da05eeedb94542197236fea32d82bc0a6f8b0e9 100644 (file)
@@ -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,
index 6a6a7a92d645ac56bcb6d3e702cbf4c5e89a237e..1bf8cbdb736962aec6104b1e3dcaa35d90cd50d8 100644 (file)
@@ -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);
index a81733e38af2f443685795ca6e49e12a1f1cbaf1..45a0505773e66d6e2ee863ff3dab0ba4df975560 100644 (file)
@@ -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) {
index 6859bce6bcb166b3fd9051cac08b3f85b89c49b0..f0d9b17591c64b9bb0c81d5910c0de03c5ab2e40 100644 (file)
@@ -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))