aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-07-17 05:57:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-17 05:57:34 -0700
commit91110195a2eee170c11885da9d16f94b00a39f87 (patch)
tree4dc22ce2b05e9cde0369d2f4d97bb18cd8d2f6aa /gm
parentac66a8122b27c388cc74b3913d9a9be351a44e54 (diff)
Revert of guard to remove DrawBitmapRectFlags (patchset #1 id:1 of https://codereview.chromium.org/1235393003/)
Reason for revert: breaking android framework build Original issue's description: > guard to remove DrawBitmapRectFlags > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/6fb0b6779e40ce05c20cf279f0ecff31fa3cd60d TBR=fmalita@chromium.org,djsollen@google.com,reed@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1230823007
Diffstat (limited to 'gm')
-rw-r--r--gm/bitmaprect.cpp12
-rw-r--r--gm/drawbitmaprect.cpp25
-rw-r--r--gm/tallstretchedbitmaps.cpp2
-rw-r--r--gm/verylargebitmap.cpp2
4 files changed, 23 insertions, 18 deletions
diff --git a/gm/bitmaprect.cpp b/gm/bitmaprect.cpp
index 7e833cb6c8..ff52c15e5d 100644
--- a/gm/bitmaprect.cpp
+++ b/gm/bitmaprect.cpp
@@ -73,7 +73,7 @@ protected:
canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint,
SkCanvas::kStrict_SrcRectConstraint);
} else {
- canvas->drawBitmapRect(bitmap, src[i], dstR, &paint);
+ canvas->drawBitmapRect(bitmap, &src[i], dstR, &paint);
}
canvas->drawRect(dstR, paint);
@@ -143,7 +143,7 @@ protected:
SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f };
SkRect dstR = { 100, 100, 300, 200 };
- canvas->drawBitmapRect(bitmap, &srcR, dstR, NULL);
+ canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL);
}
private:
@@ -213,16 +213,16 @@ protected:
SkRect dstR2 = { 10, 410, 30, 430 };
if (!fUseIRect) {
- canvas->drawBitmapRect(fBigBitmap, &srcR1, dstR1, &paint);
- canvas->drawBitmapRect(fBigBitmap, &srcR2, dstR2, &paint);
+ canvas->drawBitmapRectToRect(fBigBitmap, &srcR1, dstR1, &paint);
+ canvas->drawBitmapRectToRect(fBigBitmap, &srcR2, dstR2, &paint);
} else {
SkIRect iSrcR1, iSrcR2;
srcR1.roundOut(&iSrcR1);
srcR2.roundOut(&iSrcR2);
- canvas->drawBitmapRect(fBigBitmap, iSrcR1, dstR1, &paint);
- canvas->drawBitmapRect(fBigBitmap, iSrcR2, dstR2, &paint);
+ canvas->drawBitmapRect(fBigBitmap, &iSrcR1, dstR1, &paint);
+ canvas->drawBitmapRect(fBigBitmap, &iSrcR2, dstR2, &paint);
}
}
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 9db5ca71da..715f45b904 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -79,25 +79,30 @@ static SkImage* makebm(SkBitmap* bm, int w, int h) {
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);
+ canvas->drawBitmapRect(bm, srcR, dstR);
}
-static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect& srcR,
+static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const SkIRect* srcIR,
const SkRect& dstR) {
- canvas->drawImageRect(image, srcR, dstR, NULL);
+ 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,
+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 @@ static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, co
}
}
-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 @@ protected:
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 @@ protected:
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
paint.setMaskFilter(mf)->unref();
- canvas->drawBitmapRect(bm, srcRect, dstRect, &paint);
+ canvas->drawBitmapRect(bm, &srcRect, dstRect, &paint);
}
}
diff --git a/gm/tallstretchedbitmaps.cpp b/gm/tallstretchedbitmaps.cpp
index 4581f10ac2..424aa3a94f 100644
--- a/gm/tallstretchedbitmaps.cpp
+++ b/gm/tallstretchedbitmaps.cpp
@@ -88,7 +88,7 @@ protected:
SkRect dstRect = SkRect::MakeWH(SkIntToScalar(bmp.width()), 10.f * itemHeight);
SkPaint paint;
paint.setFilterQuality(kLow_SkFilterQuality);
- canvas->drawBitmapRect(bmp, subRect, dstRect, &paint);
+ canvas->drawBitmapRect(bmp, &subRect, dstRect, &paint);
canvas->translate(SkIntToScalar(bmp.width() + 10), 0);
}
}
diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp
index 0dca1d7be6..753786b97e 100644
--- a/gm/verylargebitmap.cpp
+++ b/gm/verylargebitmap.cpp
@@ -45,7 +45,7 @@ static void show_bm(SkCanvas* canvas, int width, int height, SkColor colors[2])
r.offset(SkIntToScalar(150), 0);
// exercises extract bitmap, but not shader
- canvas->drawBitmapRect(bm, ir, r, NULL);
+ canvas->drawBitmapRect(bm, &ir, r, NULL);
canvas->drawRect(r, paint);
r.offset(SkIntToScalar(150), 0);