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

Unified Diff: cc/layers/tiled_layer.cc

Issue 567743003: Fix bad scaling in TiledLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk Created 6 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 | « cc/layers/content_layer.cc ('k') | cc/layers/tiled_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/tiled_layer.cc
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc
index a76fbe310a0bb52d8f592b8abeb3c32567f9a53d..1f30b45a0c26c4f413da8582907f682b8f3bc1b4 100644
--- a/cc/layers/tiled_layer.cc
+++ b/cc/layers/tiled_layer.cc
@@ -462,12 +462,8 @@ void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect,
const OcclusionTracker<Layer>* occlusion) {
// The update_rect should be in layer space. So we have to convert the
// paint_rect from content space to layer space.
- float width_scale =
- paint_properties().bounds.width() /
- static_cast<float>(content_bounds().width());
- float height_scale =
- paint_properties().bounds.height() /
- static_cast<float>(content_bounds().height());
+ float width_scale = 1 / draw_properties().contents_scale_x;
+ float height_scale = 1 / draw_properties().contents_scale_y;
update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale);
// Calling PrepareToUpdate() calls into WebKit to paint, which may have the
@@ -476,8 +472,11 @@ void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect,
// the SkCanvas until the paint finishes, so we grab a local reference here to
// hold the updater alive until the paint completes.
scoped_refptr<LayerUpdater> protector(Updater());
- Updater()->PrepareToUpdate(
- paint_rect, tiler_->tile_size(), 1.f / width_scale, 1.f / height_scale);
+ Updater()->PrepareToUpdate(content_bounds(),
+ paint_rect,
+ tiler_->tile_size(),
+ 1.f / width_scale,
+ 1.f / height_scale);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/layers/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698