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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 11644008: Migrate from MathUtil::inverse() to gfx::Transform::GetInverse() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 7 years, 12 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_common_unittest.cc ('k') | cc/math_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 55f6452ded8bc55344b72f71dc08478de00335a7..571f990ed845f10b9f25c8ee4f43171c2ebba6b3 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -491,8 +491,6 @@ static void appendQuadsToFillScreen(RenderPass* targetRenderPass, LayerImpl* roo
// doesn't have any bounds and so can't generate this itself.
// FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
- DCHECK(rootLayer->screenSpaceTransform().IsInvertible());
-
gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
float opacity = 1;
SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::Create());
@@ -504,10 +502,13 @@ static void appendQuadsToFillScreen(RenderPass* targetRenderPass, LayerImpl* roo
opacity);
AppendQuadsData appendQuadsData;
- gfx::Transform transformToLayerSpace = MathUtil::inverse(rootLayer->screenSpaceTransform());
+
+ gfx::Transform transformToLayerSpace(gfx::Transform::kSkipInitialization);
+ bool didInvert = rootLayer->screenSpaceTransform().GetInverse(&transformToLayerSpace);
+ DCHECK(didInvert);
for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects.next()) {
// The root layer transform is composed of translations and scales only,
- // no perspective, so mapping is sufficient.
+ // no perspective, so mapping is sufficient (as opposed to projecting).
gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fillRects.rect());
// Skip the quad culler and just append the quads directly to avoid
// occlusion checks.
@@ -1277,7 +1278,11 @@ static gfx::Vector2dF scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewp
// Layers with non-invertible screen space transforms should not have passed the scroll hit
// test in the first place.
DCHECK(layerImpl.screenSpaceTransform().IsInvertible());
- gfx::Transform inverseScreenSpaceTransform = MathUtil::inverse(layerImpl.screenSpaceTransform());
+ gfx::Transform inverseScreenSpaceTransform(gfx::Transform::kSkipInitialization);
+ bool didInvert = layerImpl.screenSpaceTransform().GetInverse(&inverseScreenSpaceTransform);
+ // TODO: With the advent of impl-side crolling for non-root layers, we may
+ // need to explicitly handle uninvertible transforms here.
+ DCHECK(didInvert);
gfx::PointF screenSpacePoint = gfx::ScalePoint(viewportPoint, scaleFromViewportToScreenSpace);
« no previous file with comments | « cc/layer_tree_host_common_unittest.cc ('k') | cc/math_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698