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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 continue; | 142 continue; |
143 | 143 |
144 PropertyTreeState transformAndClipState(effect->localTransformSpace(), | 144 PropertyTreeState transformAndClipState(effect->localTransformSpace(), |
145 effect->outputClip(), nullptr); | 145 effect->outputClip(), nullptr); |
146 bool hasRadius = result.hasRadius(); | 146 bool hasRadius = result.hasRadius(); |
147 result = sourceToDestinationVisualRectInternal( | 147 result = sourceToDestinationVisualRectInternal( |
148 result.rect(), lastTransformAndClipState, transformAndClipState, | 148 result.rect(), lastTransformAndClipState, transformAndClipState, |
149 success); | 149 success); |
150 hasRadius |= result.hasRadius(); | 150 hasRadius |= result.hasRadius(); |
151 if (!success) { | 151 if (!success) { |
152 result.setHasRadius(hasRadius); | 152 if (hasRadius) |
| 153 result.setHasRadius(); |
153 return result; | 154 return result; |
154 } | 155 } |
155 | 156 |
156 result = effect->mapRect(result.rect()); | 157 result = effect->mapRect(result.rect()); |
157 result.setHasRadius(hasRadius); | 158 if (hasRadius) |
| 159 result.setHasRadius(); |
158 lastTransformAndClipState = transformAndClipState; | 160 lastTransformAndClipState = transformAndClipState; |
159 } | 161 } |
160 | 162 |
161 PropertyTreeState finalTransformAndClipState(ancestorState.transform(), | 163 PropertyTreeState finalTransformAndClipState(ancestorState.transform(), |
162 ancestorState.clip(), nullptr); | 164 ancestorState.clip(), nullptr); |
163 bool hasRadius = result.hasRadius(); | 165 bool hasRadius = result.hasRadius(); |
164 result = sourceToDestinationVisualRectInternal( | 166 result = sourceToDestinationVisualRectInternal( |
165 result.rect(), lastTransformAndClipState, finalTransformAndClipState, | 167 result.rect(), lastTransformAndClipState, finalTransformAndClipState, |
166 success); | 168 success); |
167 result.setHasRadius(hasRadius || result.hasRadius()); | 169 if (hasRadius || result.hasRadius()) |
| 170 result.setHasRadius(); |
168 return result; | 171 return result; |
169 } | 172 } |
170 | 173 |
171 FloatRect GeometryMapper::localToAncestorRect( | 174 FloatRect GeometryMapper::localToAncestorRect( |
172 const FloatRect& rect, | 175 const FloatRect& rect, |
173 const TransformPaintPropertyNode* localTransformNode, | 176 const TransformPaintPropertyNode* localTransformNode, |
174 const TransformPaintPropertyNode* ancestorTransformNode) { | 177 const TransformPaintPropertyNode* ancestorTransformNode) { |
175 bool success = false; | 178 bool success = false; |
176 FloatRect result = localToAncestorRectInternal( | 179 FloatRect result = localToAncestorRectInternal( |
177 rect, localTransformNode, ancestorTransformNode, success); | 180 rect, localTransformNode, ancestorTransformNode, success); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 for (auto it = intermediateNodes.rbegin(); it != intermediateNodes.rend(); | 344 for (auto it = intermediateNodes.rbegin(); it != intermediateNodes.rend(); |
342 ++it) { | 345 ++it) { |
343 success = false; | 346 success = false; |
344 const TransformationMatrix& transformMatrix = localToAncestorMatrixInternal( | 347 const TransformationMatrix& transformMatrix = localToAncestorMatrixInternal( |
345 (*it)->localTransformSpace(), ancestorTransform, success); | 348 (*it)->localTransformSpace(), ancestorTransform, success); |
346 if (!success) | 349 if (!success) |
347 return clip; | 350 return clip; |
348 FloatRect mappedRect = transformMatrix.mapRect((*it)->clipRect().rect()); | 351 FloatRect mappedRect = transformMatrix.mapRect((*it)->clipRect().rect()); |
349 clip.intersect(mappedRect); | 352 clip.intersect(mappedRect); |
350 if ((*it)->clipRect().isRounded()) | 353 if ((*it)->clipRect().isRounded()) |
351 clip.setHasRadius(true); | 354 clip.setHasRadius(); |
352 clipCache.set(*it, clip); | 355 clipCache.set(*it, clip); |
353 } | 356 } |
354 | 357 |
355 success = true; | 358 success = true; |
356 return clipCache.find(descendant)->value; | 359 return clipCache.find(descendant)->value; |
357 } | 360 } |
358 | 361 |
359 const TransformationMatrix& GeometryMapper::localToAncestorMatrix( | 362 const TransformationMatrix& GeometryMapper::localToAncestorMatrix( |
360 const TransformPaintPropertyNode* localTransformNode, | 363 const TransformPaintPropertyNode* localTransformNode, |
361 const TransformPaintPropertyNode* ancestorTransformNode) { | 364 const TransformPaintPropertyNode* ancestorTransformNode) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 const TransformPaintPropertyNode*, | 470 const TransformPaintPropertyNode*, |
468 const TransformPaintPropertyNode*); | 471 const TransformPaintPropertyNode*); |
469 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 472 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
470 const ClipPaintPropertyNode*, | 473 const ClipPaintPropertyNode*, |
471 const ClipPaintPropertyNode*); | 474 const ClipPaintPropertyNode*); |
472 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 475 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
473 const ScrollPaintPropertyNode*, | 476 const ScrollPaintPropertyNode*, |
474 const ScrollPaintPropertyNode*); | 477 const ScrollPaintPropertyNode*); |
475 | 478 |
476 } // namespace blink | 479 } // namespace blink |
OLD | NEW |