aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar humper <humper@google.com>2014-08-27 07:56:49 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-27 07:56:49 -0700
commitce7b1d5fadda5e0fd5a40257d4c8e1b6a0279597 (patch)
tree7cd0349592808ef4629a17631f1bdd6f356bf9bf /tests
parent390f62479a38ae698c5ed9eb55c3cf5a37b5eca0 (diff)
always scale to an integer; compensate for fractional image sizes by leaving the fractional scale in the matrix
BUG=skia: R=reed@google.com Author: humper@google.com Review URL: https://codereview.chromium.org/470233002
Diffstat (limited to 'tests')
-rw-r--r--tests/ScaledImageCache.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/ScaledImageCache.cpp b/tests/ScaledImageCache.cpp
index 276a3cc17a..ffab2adee7 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.