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

Unified Diff: cc/layers/painted_scrollbar_layer.cc

Issue 150603004: Fixed rounding issue on scrollbar rasterization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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: cc/layers/painted_scrollbar_layer.cc
diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc
index 71a37d48883f8f07d592ff561e288e344917ed65..493e74adb24769f1999e9ffd1e0a536ac839d927 100644
--- a/cc/layers/painted_scrollbar_layer.cc
+++ b/cc/layers/painted_scrollbar_layer.cc
@@ -244,7 +244,13 @@ UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart(
skbitmap.allocPixels();
SkCanvas skcanvas(skbitmap);
- skcanvas.translate(SkFloatToScalar(-rect.x()), SkFloatToScalar(-rect.y()));
+
+ // Skia will round to the nearest pixel on scaling, so we need to take that
+ // into account when translating back to the origin.
+ float adjustmentX = round(location_.x() * contents_scale_x());
danakj 2014/01/31 18:58:43 Using location_ here looks wrong, the input |rect|
bokan 2014/01/31 19:00:40 yikes! You're right, I'll think about this some mo
+ float adjustmentY = round(location_.y() * contents_scale_y());
+ skcanvas.translate(SkFloatToScalar(-adjustmentX),
+ SkFloatToScalar(-adjustmentY));
skcanvas.scale(SkFloatToScalar(contents_scale_x()),
SkFloatToScalar(contents_scale_y()));
« 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