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

Unified Diff: gm/resizeimagefilter.cpp

Issue 1138263002: Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/imagefiltersscaled.cpp ('k') | gm/shaderbounds.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/resizeimagefilter.cpp
diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp
index 2edb802838e6fb2a30f37e5c0eb725db017c3ddf..14f76b56cfaf4b1b59a83a1bf30030c93021b9cc 100644
--- a/gm/resizeimagefilter.cpp
+++ b/gm/resizeimagefilter.cpp
@@ -32,8 +32,8 @@
SkRect dstRect;
canvas->getTotalMatrix().mapRect(&dstRect, rect);
canvas->save();
- SkScalar deviceScaleX = deviceSize.width() / dstRect.width();
- SkScalar deviceScaleY = deviceSize.height() / dstRect.height();
+ SkScalar deviceScaleX = SkScalarDiv(deviceSize.width(), dstRect.width());
+ SkScalar deviceScaleY = SkScalarDiv(deviceSize.height(), dstRect.height());
canvas->translate(rect.x(), rect.y());
canvas->scale(deviceScaleX, deviceScaleY);
canvas->translate(-rect.x(), -rect.y());
@@ -96,7 +96,7 @@
SkPaint paint;
paint.setColor(0xFF00FF00);
SkRect ovalRect = SkRect::MakeWH(16, 16);
- ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3);
+ ovalRect.inset(SkScalarDiv(2.0f, 3.0f), SkScalarDiv(2.0f, 3.0f));
bitmapCanvas.drawOval(ovalRect, paint);
}
SkRect inRect = SkRect::MakeXYWH(-4, -4, 20, 20);
« no previous file with comments | « gm/imagefiltersscaled.cpp ('k') | gm/shaderbounds.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698