Index: gm/dropshadowimagefilter.cpp |
diff --git a/gm/dropshadowimagefilter.cpp b/gm/dropshadowimagefilter.cpp |
index 512c82de01da27f08ca436a99934927148c5dfcf..81824ab7977cf5cfc69e90b38e2136dd650f0b59 100644 |
--- a/gm/dropshadowimagefilter.cpp |
+++ b/gm/dropshadowimagefilter.cpp |
@@ -67,6 +67,29 @@ |
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 { |
@@ -90,7 +113,7 @@ |
virtual void onDraw(SkCanvas* canvas) { |
void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
- draw_bitmap, draw_path, draw_paint, draw_text |
+ draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text |
}; |
SkAutoTUnref<SkColorFilter> cf( |