| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 AffineTransform& contentTransformation = currentContentTransformation(); | 114 AffineTransform& contentTransformation = currentContentTransformation(); |
| 115 AffineTransform savedContentTransformation = contentTransformation; | 115 AffineTransform savedContentTransformation = contentTransformation; |
| 116 contentTransformation = subtreeContentTransformation * contentTransformation
; | 116 contentTransformation = subtreeContentTransformation * contentTransformation
; |
| 117 | 117 |
| 118 ASSERT(!item->needsLayout()); | 118 ASSERT(!item->needsLayout()); |
| 119 item->paint(info, IntPoint()); | 119 item->paint(info, IntPoint()); |
| 120 | 120 |
| 121 contentTransformation = savedContentTransformation; | 121 contentTransformation = savedContentTransformation; |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SVGImageBufferTools::clipToImageBuffer(GraphicsContext* context, const Affi
neTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>
& imageBuffer) | 124 void SVGImageBufferTools::clipToImageBuffer(GraphicsContext* context, const Affi
neTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>
& imageBuffer, bool safeToClear) |
| 125 { | 125 { |
| 126 ASSERT(context); | 126 ASSERT(context); |
| 127 ASSERT(imageBuffer); | 127 ASSERT(imageBuffer); |
| 128 | 128 |
| 129 FloatRect absoluteTargetRect = calculateImageBufferRect(targetRect, absolute
Transform); | 129 FloatRect absoluteTargetRect = calculateImageBufferRect(targetRect, absolute
Transform); |
| 130 | 130 |
| 131 // The mask image has been created in the absolute coordinate space, as the
image should not be scaled. | 131 // The mask image has been created in the absolute coordinate space, as the
image should not be scaled. |
| 132 // So the actual masking process has to be done in the absolute coordinate s
pace as well. | 132 // So the actual masking process has to be done in the absolute coordinate s
pace as well. |
| 133 context->concatCTM(absoluteTransform.inverse()); | 133 context->concatCTM(absoluteTransform.inverse()); |
| 134 context->clipToImageBuffer(imageBuffer.get(), absoluteTargetRect); | 134 context->clipToImageBuffer(imageBuffer.get(), absoluteTargetRect); |
| 135 context->concatCTM(absoluteTransform); | 135 context->concatCTM(absoluteTransform); |
| 136 | 136 |
| 137 // When nesting resources, with objectBoundingBox as content unit types, the
re's no use in caching the | 137 // When nesting resources, with objectBoundingBox as content unit types, the
re's no use in caching the |
| 138 // resulting image buffer as the parent resource already caches the result. | 138 // resulting image buffer as the parent resource already caches the result. |
| 139 if (!currentContentTransformation().isIdentity()) | 139 if (safeToClear && !currentContentTransformation().isIdentity()) |
| 140 imageBuffer.clear(); | 140 imageBuffer.clear(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 FloatRect SVGImageBufferTools::clampedAbsoluteTargetRect(const FloatRect& absolu
teTargetRect) | 143 FloatRect SVGImageBufferTools::clampedAbsoluteTargetRect(const FloatRect& absolu
teTargetRect) |
| 144 { | 144 { |
| 145 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize)
; | 145 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize)
; |
| 146 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh
runkTo(maxImageBufferSize)); | 146 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh
runkTo(maxImageBufferSize)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 IntSize SVGImageBufferTools::clampedAbsoluteSize(const IntSize& absoluteSize) | 149 IntSize SVGImageBufferTools::clampedAbsoluteSize(const IntSize& absoluteSize) |
| 150 { | 150 { |
| 151 const IntSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize); | 151 const IntSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize); |
| 152 return absoluteSize.shrunkTo(maxImageBufferSize); | 152 return absoluteSize.shrunkTo(maxImageBufferSize); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SVGImageBufferTools::clear2DRotation(AffineTransform& transform) | 155 void SVGImageBufferTools::clear2DRotation(AffineTransform& transform) |
| 156 { | 156 { |
| 157 AffineTransform::DecomposedType decomposition; | 157 AffineTransform::DecomposedType decomposition; |
| 158 transform.decompose(decomposition); | 158 transform.decompose(decomposition); |
| 159 decomposition.angle = 0; | 159 decomposition.angle = 0; |
| 160 transform.recompose(decomposition); | 160 transform.recompose(decomposition); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } | 163 } |
| 164 | 164 |
| 165 #endif // ENABLE(SVG) | 165 #endif // ENABLE(SVG) |
| OLD | NEW |