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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp

Issue 2744743003: Add support for flattening in GeometryMapper. (Closed)
Patch Set: none Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/paint/GeometryMapper.h" 5 #include "platform/graphics/paint/GeometryMapper.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/geometry/LayoutRect.h" 8 #include "platform/geometry/LayoutRect.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 success = false; 366 success = false;
367 return m_identity; 367 return m_identity;
368 } 368 }
369 369
370 // Iterate down from the top intermediate node found in the previous loop, 370 // Iterate down from the top intermediate node found in the previous loop,
371 // computing and memoizing transforms as we go. 371 // computing and memoizing transforms as we go.
372 for (auto it = intermediateNodes.rbegin(); it != intermediateNodes.rend(); 372 for (auto it = intermediateNodes.rbegin(); it != intermediateNodes.rend();
373 it++) { 373 it++) {
374 TransformationMatrix localTransformMatrix = (*it)->matrix(); 374 TransformationMatrix localTransformMatrix = (*it)->matrix();
375 localTransformMatrix.applyTransformOrigin((*it)->origin()); 375 localTransformMatrix.applyTransformOrigin((*it)->origin());
376
377 // Flattening Lemma: flatten(A * flatten(B)) = flatten(flatten(A) * B).
378 // goo.gl/DNKyOc. Thus we can flatten transformMatrix rather than
379 // localTransformMatrix, because GeometryMapper only supports transforms
380 // into a flattened destination space.
381 if ((*it)->flattensInheritedTransform())
382 transformMatrix.flattenTo2d();
383
376 transformMatrix = transformMatrix * localTransformMatrix; 384 transformMatrix = transformMatrix * localTransformMatrix;
377 (*it)->getTransformCache().setCachedTransform(ancestorTransformNode, 385 (*it)->getTransformCache().setCachedTransform(ancestorTransformNode,
378 transformMatrix); 386 transformMatrix);
379 } 387 }
380 success = true; 388 success = true;
381 const TransformationMatrix* cachedMatrix = 389 const TransformationMatrix* cachedMatrix =
382 localTransformNode->getTransformCache().getCachedTransform( 390 localTransformNode->getTransformCache().getCachedTransform(
383 ancestorTransformNode); 391 ancestorTransformNode);
384 DCHECK(cachedMatrix); 392 DCHECK(cachedMatrix);
385 return *cachedMatrix; 393 return *cachedMatrix;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 const TransformPaintPropertyNode*, 449 const TransformPaintPropertyNode*,
442 const TransformPaintPropertyNode*); 450 const TransformPaintPropertyNode*);
443 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( 451 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor(
444 const ClipPaintPropertyNode*, 452 const ClipPaintPropertyNode*,
445 const ClipPaintPropertyNode*); 453 const ClipPaintPropertyNode*);
446 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( 454 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor(
447 const ScrollPaintPropertyNode*, 455 const ScrollPaintPropertyNode*,
448 const ScrollPaintPropertyNode*); 456 const ScrollPaintPropertyNode*);
449 457
450 } // namespace blink 458 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698