| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (resourceMode & ApplyToStrokeMode) { | 250 if (resourceMode & ApplyToStrokeMode) { |
| 251 // Non-scaling stroke needs to reset the transform back to the host tran
sform. | 251 // Non-scaling stroke needs to reset the transform back to the host tran
sform. |
| 252 if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) | 252 if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) |
| 253 computedSpaceTransform = transformOnNonScalingStroke(object, compute
dSpaceTransform); | 253 computedSpaceTransform = transformOnNonScalingStroke(object, compute
dSpaceTransform); |
| 254 } | 254 } |
| 255 return computedSpaceTransform; | 255 return computedSpaceTransform; |
| 256 } | 256 } |
| 257 | 257 |
| 258 bool RenderSVGResourceContainer::shouldTransformOnTextPainting(RenderObject* obj
ect, AffineTransform& resourceTransform) | 258 bool RenderSVGResourceContainer::shouldTransformOnTextPainting(RenderObject* obj
ect, AffineTransform& resourceTransform) |
| 259 { | 259 { |
| 260 ASSERT_UNUSED(object, object); | 260 ASSERT(object); |
| 261 | 261 |
| 262 // This method should only be called for RenderObjects that deal with text r
endering. Cmp. RenderObject.h's is*() methods. | 262 // This method should only be called for RenderObjects that deal with text r
endering. Cmp. RenderObject.h's is*() methods. |
| 263 ASSERT(object->isSVGText() || object->isSVGTextPath() || object->isSVGInline
()); | 263 ASSERT(object->isSVGText() || object->isSVGTextPath() || object->isSVGInline
()); |
| 264 | 264 |
| 265 // In text drawing, the scaling part of the graphics context CTM is removed,
compare SVGInlineTextBox::paintTextWithShadows. | 265 // In text drawing, the scaling part of the graphics context CTM is removed,
compare SVGInlineTextBox::paintTextWithShadows. |
| 266 // So, we use that scaling factor here, too, and then push it down to patter
n or gradient space | 266 // So, we use that scaling factor here, too, and then push it down to patter
n or gradient space |
| 267 // in order to keep the pattern or gradient correctly scaled. | 267 // in order to keep the pattern or gradient correctly scaled. |
| 268 float scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFac
tor(object); | 268 float scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFac
tor(object); |
| 269 if (scalingFactor == 1) | 269 if (scalingFactor == 1) |
| 270 return false; | 270 return false; |
| 271 resourceTransform.scale(scalingFactor); | 271 resourceTransform.scale(scalingFactor); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 // FIXME: This does not belong here. | 275 // FIXME: This does not belong here. |
| 276 AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderOb
ject* object, const AffineTransform& resourceTransform) | 276 AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderOb
ject* object, const AffineTransform& resourceTransform) |
| 277 { | 277 { |
| 278 if (!object->isSVGShape()) | 278 if (!object->isSVGShape()) |
| 279 return resourceTransform; | 279 return resourceTransform; |
| 280 | 280 |
| 281 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); | 281 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); |
| 282 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall
owStyleUpdate); | 282 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall
owStyleUpdate); |
| 283 transform *= resourceTransform; | 283 transform *= resourceTransform; |
| 284 return transform; | 284 return transform; |
| 285 } | 285 } |
| 286 | 286 |
| 287 } | 287 } |
| OLD | NEW |