diff options
Diffstat (limited to 'gm/offsetimagefilter.cpp')
-rw-r--r-- | gm/offsetimagefilter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp index 2d77bbd243..95f1a31fe5 100644 --- a/gm/offsetimagefilter.cpp +++ b/gm/offsetimagefilter.cpp @@ -70,9 +70,10 @@ protected: void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPaint& paint, SkScalar x, SkScalar y) { canvas->save(); - canvas->clipRect(SkRect::MakeXYWH(x, y, + canvas->translate(x, y); + canvas->clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()))); - canvas->drawBitmap(bitmap, x, y, &paint); + canvas->drawBitmap(bitmap, 0, 0, &paint); canvas->restore(); } @@ -88,8 +89,8 @@ protected: int x = 0, y = 0; for (size_t i = 0; i < 4; i++) { SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; - SkIRect cropRect = SkIRect::MakeXYWH(x + i * 12, - y + i * 8, + SkIRect cropRect = SkIRect::MakeXYWH(i * 12, + i * 8, bitmap->width() - i * 8, bitmap->height() - i * 12); SkImageFilter::CropRect rect(SkRect::Make(cropRect)); |