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

Unified Diff: gm/mipmap.cpp

Issue 2061553002: tweak mipmap_srgb gm to use integer coordinates (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/mipmap.cpp
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index 45b4d1512636cc5fbdb6e1e57cb5f930e517be53..7a867d4225bde63fc458c18423faad3a40e9e8d3 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;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698