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

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

Issue 2802443002: Compute rounded-ness of visual rects (Closed)
Patch Set: none Created 3 years, 8 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 #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 29 matching lines...) Expand all
40 // those of |destinationState|, returns the same value as 40 // those of |destinationState|, returns the same value as
41 // localToAncestorVisualRect. Otherwise, maps the input rect to the 41 // localToAncestorVisualRect. Otherwise, maps the input rect to the
42 // transform state which is the lowest common ancestor of 42 // transform state which is the lowest common ancestor of
43 // |sourceState.transform| and |destinationState.transform|, then multiplies 43 // |sourceState.transform| and |destinationState.transform|, then multiplies
44 // it by the the inverse transform mapping from the lowest common ancestor to 44 // it by the the inverse transform mapping from the lowest common ancestor to
45 // |destinationState.transform|. 45 // |destinationState.transform|.
46 // 46 //
47 // DCHECK fails if the clip of |destinationState| is not an ancestor of the 47 // DCHECK fails if the clip of |destinationState| is not an ancestor of the
48 // clip of |sourceState|, or the inverse transform is not invertible. 48 // clip of |sourceState|, or the inverse transform is not invertible.
49 // 49 //
50 // |mappingRect| is both input and output. 50 // |mappingRect| is both input and output.
trchen 2017/04/05 20:10:36 As discussed, could you add a TODO here, stating t
chrishtr 2017/04/05 20:22:15 Done. I put some of the comments here and some in
51 static void sourceToDestinationVisualRect( 51 static void sourceToDestinationVisualRect(
52 const PropertyTreeState& sourceState, 52 const PropertyTreeState& sourceState,
53 const PropertyTreeState& destinationState, 53 const PropertyTreeState& destinationState,
54 FloatRect& mappingRect); 54 FloatClipRect& mappingRect);
55 55
56 // Same as sourceToDestinationVisualRect() except that only transforms are 56 // Same as sourceToDestinationVisualRect() except that only transforms are
57 // applied. 57 // applied.
58 // 58 //
59 // |mappingRect| is both input and output. 59 // |mappingRect| is both input and output.
60 static void sourceToDestinationRect( 60 static void sourceToDestinationRect(
61 const TransformPaintPropertyNode* sourceTransformNode, 61 const TransformPaintPropertyNode* sourceTransformNode,
62 const TransformPaintPropertyNode* destinationTransformNode, 62 const TransformPaintPropertyNode* destinationTransformNode,
63 FloatRect& mappingRect); 63 FloatRect& mappingRect);
64 64
65 // Maps from a rect in |localTransformSpace| to its visual rect in 65 // Maps from a rect in |localTransformSpace| to its visual rect in
66 // |ancestorState|. This is computed by multiplying the rect by its combined 66 // |ancestorState|. This is computed by multiplying the rect by its combined
67 // transform between |localTransformSpace| and |ancestorSpace|, then 67 // transform between |localTransformSpace| and |ancestorSpace|, then
68 // flattening into 2D space, then intersecting by the "clip visual rect" for 68 // flattening into 2D space, then intersecting by the "clip visual rect" for
69 // |localTransformState|'s clips. See above for the definition of "clip visual 69 // |localTransformState|'s clips. See above for the definition of "clip visual
70 // rect". 70 // rect".
71 // 71 //
72 // Note that the clip of |ancestorState| is *not* applied. 72 // Note that the clip of |ancestorState| is *not* applied.
73 // 73 //
74 // DCHECK fails if any of the paint property tree nodes in 74 // DCHECK fails if any of the paint property tree nodes in
75 // |localTransformState| are not equal to or a descendant of that in 75 // |localTransformState| are not equal to or a descendant of that in
76 // |ancestorState|. 76 // |ancestorState|.
77 // 77 //
78 // |mappingRect| is both input and output. 78 // |mappingRect| is both input and output.
79 static void localToAncestorVisualRect( 79 static void localToAncestorVisualRect(
80 const PropertyTreeState& localTransformState, 80 const PropertyTreeState& localTransformState,
81 const PropertyTreeState& ancestorState, 81 const PropertyTreeState& ancestorState,
82 FloatRect& mappingRect); 82 FloatClipRect& mappingRect);
83 83
84 // Maps from a rect in |localTransformNode| space to its transformed rect in 84 // Maps from a rect in |localTransformNode| space to its transformed rect in
85 // |ancestorTransformNode| space. This is computed by multiplying the rect by 85 // |ancestorTransformNode| space. This is computed by multiplying the rect by
86 // the combined transform between |localTransformNode| and 86 // the combined transform between |localTransformNode| and
87 // |ancestorTransformNode|, then flattening into 2D space. 87 // |ancestorTransformNode|, then flattening into 2D space.
88 // 88 //
89 // DCHECK fails if |localTransformNode| is not equal to or a descendant of 89 // DCHECK fails if |localTransformNode| is not equal to or a descendant of
90 // |ancestorTransformNode|. 90 // |ancestorTransformNode|.
91 // 91 //
92 //|mappingRect| is both input and output. 92 //|mappingRect| is both input and output.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 private: 143 private:
144 // The internal methods do the same things as their public counterparts, but 144 // The internal methods do the same things as their public counterparts, but
145 // take an extra |success| parameter which indicates if the function is 145 // take an extra |success| parameter which indicates if the function is
146 // successful on return. See comments of the public functions for failure 146 // successful on return. See comments of the public functions for failure
147 // conditions. 147 // conditions.
148 148
149 static void sourceToDestinationVisualRectInternal( 149 static void sourceToDestinationVisualRectInternal(
150 const PropertyTreeState& sourceState, 150 const PropertyTreeState& sourceState,
151 const PropertyTreeState& destinationState, 151 const PropertyTreeState& destinationState,
152 FloatRect& mappingRect, 152 FloatClipRect& mappingRect,
153 bool& success); 153 bool& success);
154 154
155 static void localToAncestorVisualRectInternal( 155 static void localToAncestorVisualRectInternal(
156 const PropertyTreeState& localTransformState, 156 const PropertyTreeState& localTransformState,
157 const PropertyTreeState& ancestorState, 157 const PropertyTreeState& ancestorState,
158 FloatRect& mappingRect, 158 FloatClipRect& mappingRect,
159 bool& success); 159 bool& success);
160 160
161 static void localToAncestorRectInternal( 161 static void localToAncestorRectInternal(
162 const TransformPaintPropertyNode* localTransformNode, 162 const TransformPaintPropertyNode* localTransformNode,
163 const TransformPaintPropertyNode* ancestorTransformNode, 163 const TransformPaintPropertyNode* ancestorTransformNode,
164 FloatRect&, 164 FloatRect&,
165 bool& success); 165 bool& success);
166 166
167 static const TransformationMatrix& localToAncestorMatrixInternal( 167 static const TransformationMatrix& localToAncestorMatrixInternal(
168 const TransformPaintPropertyNode* localTransformNode, 168 const TransformPaintPropertyNode* localTransformNode,
169 const TransformPaintPropertyNode* ancestorTransformNode, 169 const TransformPaintPropertyNode* ancestorTransformNode,
170 bool& success); 170 bool& success);
171 171
172 static const FloatClipRect& localToAncestorClipRectInternal( 172 static const FloatClipRect& localToAncestorClipRectInternal(
173 const ClipPaintPropertyNode* descendant, 173 const ClipPaintPropertyNode* descendant,
174 const ClipPaintPropertyNode* ancestorClip, 174 const ClipPaintPropertyNode* ancestorClip,
175 const TransformPaintPropertyNode* ancestorTransform, 175 const TransformPaintPropertyNode* ancestorTransform,
176 bool& success); 176 bool& success);
177 177
178 static const FloatClipRect& sourceToDestinationClipRectInternal( 178 static const FloatClipRect& sourceToDestinationClipRectInternal(
179 const PropertyTreeState& sourceState, 179 const PropertyTreeState& sourceState,
180 const PropertyTreeState& destinationState, 180 const PropertyTreeState& destinationState,
181 bool& success); 181 bool& success);
182 182
183 static void slowLocalToAncestorVisualRectWithEffects( 183 static void slowLocalToAncestorVisualRectWithEffects(
184 const PropertyTreeState& localState, 184 const PropertyTreeState& localState,
185 const PropertyTreeState& ancestorState, 185 const PropertyTreeState& ancestorState,
186 FloatRect& mappingRect, 186 FloatClipRect& mappingRect,
187 bool& success); 187 bool& success);
188 188
189 static const TransformationMatrix& identityMatrix(); 189 static const TransformationMatrix& identityMatrix();
190 static const FloatClipRect& infiniteClip(); 190 static const FloatClipRect& infiniteClip();
191 static FloatClipRect& tempRect(); 191 static FloatClipRect& tempRect();
192 192
193 friend class GeometryMapperTest; 193 friend class GeometryMapperTest;
194 friend class PaintLayerClipperTest; 194 friend class PaintLayerClipperTest;
195 }; 195 };
196 196
197 } // namespace blink 197 } // namespace blink
198 198
199 #endif // GeometryMapper_h 199 #endif // GeometryMapper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698