aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-11 04:48:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-11 04:48:12 -0700
commit3cc37d3db3b8ff6a8c6f8f516ebd6cfba190d913 (patch)
tree6b92e87d8ef18d6ca1bf26d1ff4199fe30abba3a
parentcadb5a24c20d809c09d93af155a085b56cbfd2cc (diff)
tweak mipmap_srgb gm to use integer coordinates
-rw-r--r--gm/mipmap.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index 45b4d15126..7a867d4225 100644
--- a/gm/mipmap.cpp
+++ b/gm/mipmap.cpp
@@ -70,12 +70,13 @@ static void show_mips(SkCanvas* canvas, SkImage* img) {
SkPaint paint;
paint.setFilterQuality(kMedium_SkFilterQuality);
- SkRect dst = SkRect::MakeIWH(img->width(), img->height());
+ // Want to ensure we never draw fractional pixels, so we use an IRect
+ SkIRect dst = SkIRect::MakeWH(img->width(), img->height());
while (dst.width() > 5) {
- canvas->drawImageRect(img, dst, &paint);
+ canvas->drawImageRect(img, SkRect::Make(dst), &paint);
dst.offset(dst.width() + 10, 0);
- dst.fRight = dst.fLeft + SkScalarHalf(dst.width());
- dst.fBottom = dst.fTop + SkScalarHalf(dst.height());
+ dst.fRight = dst.fLeft + dst.width()/2;
+ dst.fBottom = dst.fTop + dst.height()/2;
}
}