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

Unified Diff: tests/ScaledImageCache.cpp

Issue 470233002: always scale to an integer; compensate for fractional image sizes by leaving the fractional scale i… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more git rebase Created 6 years, 4 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 | « src/core/SkBitmapProcState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ScaledImageCache.cpp
diff --git a/tests/ScaledImageCache.cpp b/tests/ScaledImageCache.cpp
index 276a3cc17a4549b1d39d09af1277ab0b576a88a8..ffab2adee7c29e201354fb19560ec1108072ff5b 100644
--- a/tests/ScaledImageCache.cpp
+++ b/tests/ScaledImageCache.cpp
@@ -17,7 +17,9 @@ static bool is_in_scaled_image_cache(const SkBitmap& orig,
SkScalar xScale,
SkScalar yScale) {
SkBitmap scaled;
- return SkBitmapCache::Find(orig, SkScalarInvert(xScale), SkScalarInvert(yScale), &scaled);
+ float roundedImageWidth = SkScalarRoundToScalar(orig.width() * xScale);
+ float roundedImageHeight = SkScalarRoundToScalar(orig.height() * xScale);
+ return SkBitmapCache::Find(orig, roundedImageWidth, roundedImageHeight, &scaled);
}
// Draw a scaled bitmap, then return true iff it has been cached.
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698