OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 if (parent->isSVGRoot()) { | 138 if (parent->isSVGRoot()) { |
139 TransformationMatrix matrix(object->localToParentTransform()); | 139 TransformationMatrix matrix(object->localToParentTransform()); |
140 matrix.multiply(toRenderSVGRoot(parent)->localToBorderBoxTransform()); | 140 matrix.multiply(toRenderSVGRoot(parent)->localToBorderBoxTransform()); |
141 geometryMap.push(object, matrix); | 141 geometryMap.push(object, matrix); |
142 } else | 142 } else |
143 geometryMap.push(object, object->localToParentTransform()); | 143 geometryMap.push(object, object->localToParentTransform()); |
144 | 144 |
145 return parent; | 145 return parent; |
146 } | 146 } |
147 | 147 |
148 const AffineTransform SVGRenderSupport::transformToRootBorderBox(const RenderObj ect& renderer, const AffineTransform& localTransform) | |
149 { | |
150 AffineTransform transform = localTransform; | |
151 RenderObject* next = renderer.parent(); | |
152 while (next && !next->isSVGRoot()) { | |
pdr.
2014/12/15 05:02:21
linear algebra 101: instead of inverting each matr
fs
2014/12/15 10:28:16
If next is/ends up as null, you'll be toast anyway
pdr.
2014/12/18 22:22:40
Replaced with an assert.
| |
153 transform = next->localToParentTransform() * transform; | |
fs
2014/12/15 10:28:16
(Last I checked a sequence like this generated hor
pdr.
2014/12/16 06:29:56
It does indeed, we should add this to AffineTransf
pdr.
2014/12/18 22:22:40
I looked into this and premultiply doesn't seem as
fs
2014/12/19 11:46:00
Moves are cheap execution-wise, but cost in terms
| |
154 next = next->parent(); | |
155 } | |
156 transform = toRenderSVGRoot(next)->localToBorderBoxTransform() * transform; | |
157 | |
158 if (!transform.isInvertible()) | |
fs
2014/12/15 10:28:16
Maybe just return |transform| instead of its inver
| |
159 return AffineTransform(); | |
160 | |
161 return transform.inverse(); | |
162 } | |
163 | |
148 // Update a bounding box taking into account the validity of the other bounding box. | 164 // Update a bounding box taking into account the validity of the other bounding box. |
149 inline void SVGRenderSupport::updateObjectBoundingBox(FloatRect& objectBoundingB ox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBo x) | 165 inline void SVGRenderSupport::updateObjectBoundingBox(FloatRect& objectBoundingB ox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBo x) |
150 { | 166 { |
151 bool otherValid = other->isSVGContainer() ? toRenderSVGContainer(other)->isO bjectBoundingBoxValid() : true; | 167 bool otherValid = other->isSVGContainer() ? toRenderSVGContainer(other)->isO bjectBoundingBoxValid() : true; |
152 if (!otherValid) | 168 if (!otherValid) |
153 return; | 169 return; |
154 | 170 |
155 if (!objectBoundingBoxValid) { | 171 if (!objectBoundingBoxValid) { |
156 objectBoundingBox = otherBoundingBox; | 172 objectBoundingBox = otherBoundingBox; |
157 objectBoundingBoxValid = true; | 173 objectBoundingBoxValid = true; |
(...skipping 22 matching lines...) Expand all Loading... | |
180 | 196 |
181 const AffineTransform& transform = current->localToParentTransform(); | 197 const AffineTransform& transform = current->localToParentTransform(); |
182 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre nt, | 198 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre nt, |
183 transform.mapRect(current->objectBoundingBox())); | 199 transform.mapRect(current->objectBoundingBox())); |
184 strokeBoundingBox.unite(transform.mapRect(current->paintInvalidationRect InLocalCoordinates())); | 200 strokeBoundingBox.unite(transform.mapRect(current->paintInvalidationRect InLocalCoordinates())); |
185 } | 201 } |
186 | 202 |
187 paintInvalidationBoundingBox = strokeBoundingBox; | 203 paintInvalidationBoundingBox = strokeBoundingBox; |
188 } | 204 } |
189 | 205 |
190 bool SVGRenderSupport::paintInfoIntersectsPaintInvalidationRect(const FloatRect& localPaintInvalidationRect, const AffineTransform& localTransform, const PaintI nfo& paintInfo) | |
191 { | |
192 return localTransform.mapRect(localPaintInvalidationRect).intersects(paintIn fo.rect); | |
193 } | |
194 | |
195 const RenderSVGRoot* SVGRenderSupport::findTreeRootObject(const RenderObject* st art) | 206 const RenderSVGRoot* SVGRenderSupport::findTreeRootObject(const RenderObject* st art) |
196 { | 207 { |
197 while (start && !start->isSVGRoot()) | 208 while (start && !start->isSVGRoot()) |
198 start = start->parent(); | 209 start = start->parent(); |
199 | 210 |
200 ASSERT(start); | 211 ASSERT(start); |
201 ASSERT(start->isSVGRoot()); | 212 ASSERT(start->isSVGRoot()); |
202 return toRenderSVGRoot(start); | 213 return toRenderSVGRoot(start); |
203 } | 214 } |
204 | 215 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 return false; | 478 return false; |
468 return willIsolateBlendingDescendantsForStyle(object->style()); | 479 return willIsolateBlendingDescendantsForStyle(object->style()); |
469 } | 480 } |
470 | 481 |
471 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) | 482 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) |
472 { | 483 { |
473 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants(); | 484 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants(); |
474 } | 485 } |
475 | 486 |
476 } | 487 } |
OLD | NEW |