Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: gm/drawbitmaprect.cpp

Issue 1230823007: Revert of guard to remove DrawBitmapRectFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/bitmaprect.cpp ('k') | gm/tallstretchedbitmaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawbitmaprect.cpp
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 9db5ca71dae4b303245ce8428cc631ad300b45d7..715f45b90468d420faed6add78bc152d92cf172a 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -79,25 +79,30 @@
return image_from_bitmap(*bm);
}
-static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkIRect& srcR,
+static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkIRect* srcR,
const SkRect& dstR) {
- canvas->drawBitmapRect(bm, srcR, dstR, NULL);
-}
-
-static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcR,
+ canvas->drawBitmapRect(bm, srcR, dstR);
+}
+
+static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect* srcIR,
const SkRect& dstR) {
- canvas->drawImageRect(image, srcR, dstR, NULL);
-}
-
-static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcIR,
+ SkRect storage, *srcR = NULL;
+ if (srcIR) {
+ storage.set(*srcIR);
+ srcR = &storage;
+ }
+ canvas->drawImageRect(image, srcR, dstR);
+}
+
+static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect* srcIR,
const SkRect& dstR) {
const int newW = SkScalarRoundToInt(dstR.width());
const int newH = SkScalarRoundToInt(dstR.height());
- SkAutoTUnref<SkImage> newImage(image->newImage(newW, newH, &srcIR));
+ SkAutoTUnref<SkImage> newImage(image->newImage(newW, newH, srcIR));
#ifdef SK_DEBUG
const SkIRect baseR = SkIRect::MakeWH(image->width(), image->height());
- const bool containsSubset = baseR.contains(srcIR);
+ const bool containsSubset = !srcIR || baseR.contains(*srcIR);
#endif
if (newImage) {
@@ -116,7 +121,7 @@
}
}
-typedef void DrawRectRectProc(SkCanvas*, SkImage*, const SkBitmap&, const SkIRect&, const SkRect&);
+typedef void DrawRectRectProc(SkCanvas*, SkImage*, const SkBitmap&, const SkIRect*, const SkRect&);
static const int gSize = 1024;
static const int gBmpSize = 2048;
@@ -176,7 +181,7 @@
for (int h = 1; h <= kMaxSrcRectSize; h *= 4) {
SkIRect srcRect = SkIRect::MakeXYWH((gBmpSize - w) / 2, (gBmpSize - h) / 2, w, h);
- fProc(canvas, fImage, fLargeBitmap, srcRect, dstRect);
+ fProc(canvas, fImage, fLargeBitmap, &srcRect, dstRect);
SkString label;
label.appendf("%d x %d", w, h);
@@ -221,7 +226,7 @@
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
paint.setMaskFilter(mf)->unref();
- canvas->drawBitmapRect(bm, srcRect, dstRect, &paint);
+ canvas->drawBitmapRect(bm, &srcRect, dstRect, &paint);
}
}
« no previous file with comments | « gm/bitmaprect.cpp ('k') | gm/tallstretchedbitmaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698