| OLD | NEW |
| 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 Loading... |
| 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 | |
| 384 transformMatrix = transformMatrix * localTransformMatrix; | 376 transformMatrix = transformMatrix * localTransformMatrix; |
| 385 (*it)->getTransformCache().setCachedTransform(ancestorTransformNode, | 377 (*it)->getTransformCache().setCachedTransform(ancestorTransformNode, |
| 386 transformMatrix); | 378 transformMatrix); |
| 387 } | 379 } |
| 388 success = true; | 380 success = true; |
| 389 const TransformationMatrix* cachedMatrix = | 381 const TransformationMatrix* cachedMatrix = |
| 390 localTransformNode->getTransformCache().getCachedTransform( | 382 localTransformNode->getTransformCache().getCachedTransform( |
| 391 ancestorTransformNode); | 383 ancestorTransformNode); |
| 392 DCHECK(cachedMatrix); | 384 DCHECK(cachedMatrix); |
| 393 return *cachedMatrix; | 385 return *cachedMatrix; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 const TransformPaintPropertyNode*, | 441 const TransformPaintPropertyNode*, |
| 450 const TransformPaintPropertyNode*); | 442 const TransformPaintPropertyNode*); |
| 451 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 443 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
| 452 const ClipPaintPropertyNode*, | 444 const ClipPaintPropertyNode*, |
| 453 const ClipPaintPropertyNode*); | 445 const ClipPaintPropertyNode*); |
| 454 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 446 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
| 455 const ScrollPaintPropertyNode*, | 447 const ScrollPaintPropertyNode*, |
| 456 const ScrollPaintPropertyNode*); | 448 const ScrollPaintPropertyNode*); |
| 457 | 449 |
| 458 } // namespace blink | 450 } // namespace blink |
| OLD | NEW |