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 #ifndef GeometryMapper_h | 5 #ifndef GeometryMapper_h |
6 #define GeometryMapper_h | 6 #define GeometryMapper_h |
7 | 7 |
8 #include "platform/graphics/paint/FloatClipRect.h" | 8 #include "platform/graphics/paint/FloatClipRect.h" |
9 #include "platform/graphics/paint/PropertyTreeState.h" | 9 #include "platform/graphics/paint/PropertyTreeState.h" |
10 #include "platform/transforms/TransformationMatrix.h" | 10 #include "platform/transforms/TransformationMatrix.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 const FloatRect&, | 149 const FloatRect&, |
150 const TransformPaintPropertyNode* localTransformNode, | 150 const TransformPaintPropertyNode* localTransformNode, |
151 const TransformPaintPropertyNode* ancestorTransformNode, | 151 const TransformPaintPropertyNode* ancestorTransformNode, |
152 bool& success); | 152 bool& success); |
153 | 153 |
154 const TransformationMatrix& localToAncestorMatrixInternal( | 154 const TransformationMatrix& localToAncestorMatrixInternal( |
155 const TransformPaintPropertyNode* localTransformNode, | 155 const TransformPaintPropertyNode* localTransformNode, |
156 const TransformPaintPropertyNode* ancestorTransformNode, | 156 const TransformPaintPropertyNode* ancestorTransformNode, |
157 bool& success); | 157 bool& success); |
158 | 158 |
159 FloatClipRect localToAncestorClipRectInternal( | 159 const FloatClipRect& localToAncestorClipRectInternal( |
160 const ClipPaintPropertyNode* descendant, | 160 const ClipPaintPropertyNode* descendant, |
161 const ClipPaintPropertyNode* ancestorClip, | 161 const ClipPaintPropertyNode* ancestorClip, |
162 const TransformPaintPropertyNode* ancestorTransform, | 162 const TransformPaintPropertyNode* ancestorTransform, |
163 bool& success); | 163 bool& success); |
164 | 164 |
165 FloatClipRect sourceToDestinationClipRectInternal( | 165 FloatClipRect sourceToDestinationClipRectInternal( |
166 const PropertyTreeState& sourceState, | 166 const PropertyTreeState& sourceState, |
167 const PropertyTreeState& destinationState, | 167 const PropertyTreeState& destinationState, |
168 bool& success); | 168 bool& success); |
169 | 169 |
170 FloatClipRect slowLocalToAncestorVisualRectWithEffects( | 170 FloatClipRect slowLocalToAncestorVisualRectWithEffects( |
171 const FloatRect&, | 171 const FloatRect&, |
172 const PropertyTreeState& localState, | 172 const PropertyTreeState& localState, |
173 const PropertyTreeState& ancestorState, | 173 const PropertyTreeState& ancestorState, |
174 bool& success); | 174 bool& success); |
175 | 175 |
176 // Maps from a transform node that is a descendant of the implied ancestor | |
177 // transform node to the combined transform between the descendant's and the | |
178 // ancestor's coordinate space. | |
179 // The "implied ancestor" is the key of the m_transformCache object for which | |
180 // this TransformCache is a value. | |
181 using TransformCache = | |
182 HashMap<const TransformPaintPropertyNode*, TransformationMatrix>; | |
183 | |
184 // Returns the transform cache for the given ancestor transform node. | |
185 TransformCache& getTransformCache(const TransformPaintPropertyNode* ancestor); | |
186 | |
187 // Maps from a descendant clip node to its equivalent "clip visual rect" in | |
188 // the local transform space of the implied ancestor clip node. The clip | |
189 // visual rect is defined as the intersection of all clips between the | |
190 // descendant and the ancestor (*not* including the ancestor) in the clip | |
191 // tree, individually transformed from their localTransformSpace into the | |
192 // ancestor's localTransformSpace. If one of the clips that contributes to it | |
193 // has a border radius, the hasRadius() field is set to true. | |
194 // The "implied ancestor" is the key of the TransformToClip cachefor which | |
195 // this ClipCache is a value. | |
196 using ClipCache = HashMap<const ClipPaintPropertyNode*, FloatClipRect>; | |
197 | |
198 using TransformToClip = | |
199 HashMap<const TransformPaintPropertyNode*, std::unique_ptr<ClipCache>>; | |
200 | |
201 // Returns the clip cache for the given transform space relative to the | |
202 // given ancestor clip node. | |
203 ClipCache& getClipCache(const ClipPaintPropertyNode* ancestorClip, | |
204 const TransformPaintPropertyNode* ancestorTransform); | |
205 | |
206 friend class GeometryMapperTest; | 176 friend class GeometryMapperTest; |
207 friend class PaintLayerClipperTest; | 177 friend class PaintLayerClipperTest; |
208 | 178 |
209 HashMap<const TransformPaintPropertyNode*, std::unique_ptr<TransformCache>> | |
210 m_transformCache; | |
211 HashMap<const ClipPaintPropertyNode*, std::unique_ptr<TransformToClip>> | |
212 m_clipCache; | |
213 | |
214 const TransformationMatrix m_identity; | 179 const TransformationMatrix m_identity; |
| 180 const FloatClipRect m_infiniteClip; |
215 | 181 |
216 DISALLOW_COPY_AND_ASSIGN(GeometryMapper); | 182 DISALLOW_COPY_AND_ASSIGN(GeometryMapper); |
217 }; | 183 }; |
218 | 184 |
219 } // namespace blink | 185 } // namespace blink |
220 | 186 |
221 #endif // GeometryMapper_h | 187 #endif // GeometryMapper_h |
OLD | NEW |