Chromium Code Reviews| Index: cc/layers/render_surface_impl.cc |
| diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc |
| index 741526a8db0904ac03824340c84eb6e0fe5b563b..303fca9519ab0484b06353854fc161769070bbfe 100644 |
| --- a/cc/layers/render_surface_impl.cc |
| +++ b/cc/layers/render_surface_impl.cc |
| @@ -250,16 +250,33 @@ void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink, |
| gfx::Vector2dF owning_layer_draw_scale = |
| MathUtil::ComputeTransform2dScaleComponents( |
| owning_layer_->draw_transform(), 1.f); |
| - gfx::SizeF unclipped_surface_size = gfx::ScaleSize( |
| + gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( |
| owning_layer_->content_bounds(), |
| owning_layer_draw_scale.x(), |
| owning_layer_draw_scale.y()); |
| - // This assumes that the owning layer clips its subtree when a mask is |
| - // present. |
| - DCHECK(gfx::RectF(unclipped_surface_size).Contains(content_rect_)); |
| - |
| - float uv_scale_x = content_rect_.width() / unclipped_surface_size.width(); |
| - float uv_scale_y = content_rect_.height() / unclipped_surface_size.height(); |
| + gfx::SizeF clipped_mask_target_size = gfx::IntersectRects( |
|
enne (OOO)
2013/04/16 21:06:44
I'm a little confused about this intersection. Do
danakj
2013/04/16 21:21:01
This is the old behaviour minus assumptions that t
shawnsingh
2013/04/16 23:08:26
I don't understand this - if the surface has a mas
danakj
2013/04/16 23:13:55
if the replica has a mask, the layer does not mask
|
| + gfx::RectF(unclipped_mask_target_size), content_rect_).size(); |
| + |
| + gfx::Vector2dF unclipped_to_clipped_mask_target_size( |
| + clipped_mask_target_size.width() / |
| + unclipped_mask_target_size.width(), |
| + clipped_mask_target_size.height() / |
| + unclipped_mask_target_size.height()); |
| + |
| + gfx::Vector2dF owning_layer_to_mask_layer_bounds_ratio( |
|
enne (OOO)
2013/04/16 21:06:44
This whole function needs a lot more comments abou
danakj
2013/04/16 21:21:01
ok, will add.
|
| + (static_cast<float>(mask_layer->content_bounds().width()) / |
| + mask_layer->bounds().width()) / |
| + (static_cast<float>(owning_layer_->content_bounds().width()) / |
| + owning_layer_->bounds().width()), |
| + (static_cast<float>(mask_layer->content_bounds().height()) / |
| + mask_layer->bounds().height()) / |
| + (static_cast<float>(owning_layer_->content_bounds().height()) / |
| + owning_layer_->bounds().height())); |
| + |
| + float uv_scale_x = unclipped_to_clipped_mask_target_size.x() * |
| + owning_layer_to_mask_layer_bounds_ratio.x(); |
| + float uv_scale_y = unclipped_to_clipped_mask_target_size.y() * |
| + owning_layer_to_mask_layer_bounds_ratio.y(); |
| mask_uv_rect = gfx::RectF( |
| uv_scale_x * content_rect_.x() / content_rect_.width(), |