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

Unified Diff: cc/render_surface_impl.cc

Issue 11883027: Fix masks when scaling is in the tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 7 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 | « cc/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/render_surface_impl.cc
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index bc3d7303ba917f79bf2d4abed882ec33d6c69e9f..8023da68239d2e1dc864095b994075866f338213 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -224,8 +224,14 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
gfx::RectF maskUVRect(0.0f, 0.0f, 1.0f, 1.0f);
if (maskLayer) {
- float scaleX = contentRect().width() / maskLayer->contentsScaleX() / maskLayer->bounds().width();
- float scaleY = contentRect().height() / maskLayer->contentsScaleY() / maskLayer->bounds().height();
+ // Because the RenderSurface is sized base on the screen footprint,
+ // there can be a scale between the RenderSurface and the owning layer,
+ // as well as the mask. While the mask doesn't have a drawTransform, the
+ // owning layer has it (and should be pure scaling), so use that to
+ // scale the mask to the right size.
+ gfx::Vector2dF maskDrawScale = MathUtil::computeTransform2dScaleComponents(m_owningLayer->drawTransform(), 1.f);
enne (OOO) 2013/01/15 04:12:43 This will work given the current implementation of
danakj 2013/01/15 16:31:11 I'm not sure I agree. My POV is that the mask is a
danakj 2013/01/15 17:11:53 Ok I take this back. I had developed an impression
+ float scaleX = contentRect().width() / maskLayer->contentsScaleX() / maskLayer->bounds().width() / maskDrawScale.x();
+ float scaleY = contentRect().height() / maskLayer->contentsScaleY() / maskLayer->bounds().height() / maskDrawScale.y();
maskUVRect = gfx::RectF(static_cast<float>(contentRect().x()) / contentRect().width() * scaleX,
static_cast<float>(contentRect().y()) / contentRect().height() * scaleY,
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698