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

Unified Diff: cc/layers/surface_layer_impl.cc

Issue 2673813002: Changes the bounds being sent for occlusion from physical pixels to DIP (Closed)
Patch Set: Use gfx::ScaleToEnclosingRect instead of gfx::ScaleToEnclosedRect Created 3 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/surface_layer_impl_unittest.cc » ('j') | cc/layers/surface_layer_impl_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/surface_layer_impl.cc
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc
index e23e789c4096276c97274f64399be9e3d91d9b13..658dc1ee22faec44ad569b014aae2305875d55b1 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -59,19 +59,22 @@ void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass,
SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
+ float scale_x, scale_y;
danakj 2017/02/10 16:32:22 Can you give this a name that describes what the s
malaykeshav 2017/02/10 20:24:58 Done
+
if (stretch_content_to_fill_bounds_) {
// Stretches the surface contents to exactly fill the layer bounds,
// regardless of scale or aspect ratio differences.
- float scale_x = static_cast<float>(surface_info_.size_in_pixels().width()) /
- bounds().width();
- float scale_y =
- static_cast<float>(surface_info_.size_in_pixels().height()) /
- bounds().height();
+ scale_x = static_cast<float>(surface_info_.size_in_pixels().width()) /
+ bounds().width();
+ scale_y = static_cast<float>(surface_info_.size_in_pixels().height()) /
+ bounds().height();
PopulateScaledSharedQuadState(shared_quad_state, scale_x, scale_y);
} else {
PopulateScaledSharedQuadState(shared_quad_state,
danakj 2017/02/10 16:32:22 We don't need 2 calls to Populate anymore, if we h
malaykeshav 2017/02/10 20:24:58 Done
surface_info_.device_scale_factor(),
surface_info_.device_scale_factor());
+
+ scale_x = scale_y = surface_info_.device_scale_factor();
}
if (!surface_info_.id().is_valid())
@@ -80,7 +83,11 @@ void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass,
gfx::Rect quad_rect(surface_info_.size_in_pixels());
gfx::Rect visible_quad_rect =
draw_properties().occlusion_in_content_space.GetUnoccludedContentRect(
- quad_rect);
+ gfx::Rect(bounds()));
+
+ visible_quad_rect =
+ gfx::ScaleToEnclosedRect(visible_quad_rect, scale_x, scale_y);
+ visible_quad_rect = gfx::IntersectRects(quad_rect, visible_quad_rect);
if (visible_quad_rect.IsEmpty())
return;
« no previous file with comments | « no previous file | cc/layers/surface_layer_impl_unittest.cc » ('j') | cc/layers/surface_layer_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698