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

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: Added test Created 6 years, 10 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 | cc/layers/scrollbar_layer_unittest.cc » ('j') | cc/layers/scrollbar_layer_unittest.cc » ('J')
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..ae8efd00bdbbf11c9b77b92ad73a794bd1b02b31 100644
--- a/cc/layers/painted_scrollbar_layer.cc
+++ b/cc/layers/painted_scrollbar_layer.cc
@@ -169,7 +169,7 @@ gfx::Rect PaintedScrollbarLayer::ScrollbarLayerRectToContentRect(
const gfx::Rect& layer_rect) const {
// Don't intersect with the bounds as in LayerRectToContentRect() because
// layer_rect here might be in coordinates of the containing layer.
- gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect(
+ gfx::Rect expanded_rect = gfx::ScaleToEnclosedRect(
danakj 2014/02/10 19:17:28 I don't believe this is correct. Say you have a s
layer_rect, contents_scale_y(), contents_scale_y());
// We should never return a rect bigger than the content_bounds().
gfx::Size clamped_size = expanded_rect.size();
@@ -248,6 +248,8 @@ UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart(
skcanvas.scale(SkFloatToScalar(contents_scale_x()),
SkFloatToScalar(contents_scale_y()));
+ // Since rect is an enclosed rect around the scaled layer_rect, we must take
+ // the enclosing rect when unscaling so we don't lose a pixel in truncation.
gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(
danakj 2014/02/10 19:17:28 It seems like this one is the one we should switch
danakj 2014/02/10 19:19:37 A possible nice change would be to pass in the lay
bokan 2014/02/11 00:01:53 If the one above is enclosed then it can be clippe
rect, 1.f / contents_scale_x(), 1.f / contents_scale_y());
SkRect layer_skrect = RectToSkRect(layer_rect);
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_unittest.cc » ('j') | cc/layers/scrollbar_layer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698