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

Unified Diff: src/codec/SkScaledCodec.cpp

Issue 1356923002: Use rounding when converting desiredScale to a sampleSize (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « dm/DM.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkScaledCodec.cpp
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index cf678db8565d0b131d359b28ab6256379e825971..951ab27b1c73def82b545237fe485e4dab58390a 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -87,7 +87,7 @@ SkISize SkScaledCodec::onGetScaledDimensions(float desiredScale) const {
}
// sampleSize determines the step size between samples
// Ex: sampleSize = 2, sample every second pixel in x and y directions
- int sampleSize = int(1 / desiredScale);
+ int sampleSize = int ((1.0f / desiredScale) + 0.5f);
int scaledWidth = get_scaled_dimension(this->getInfo().width(), sampleSize);
int scaledHeight = get_scaled_dimension(this->getInfo().height(), sampleSize);
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698