OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TY
PE_OBJECTBOUNDINGBOX) { | 124 if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TY
PE_OBJECTBOUNDINGBOX) { |
125 FloatRect objectBoundingBox = object->objectBoundingBox(); | 125 FloatRect objectBoundingBox = object->objectBoundingBox(); |
126 maskContentTransformation.translate(objectBoundingBox.x(), objectBoundin
gBox.y()); | 126 maskContentTransformation.translate(objectBoundingBox.x(), objectBoundin
gBox.y()); |
127 maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), obj
ectBoundingBox.height()); | 127 maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), obj
ectBoundingBox.height()); |
128 maskImageContext->concatCTM(maskContentTransformation); | 128 maskImageContext->concatCTM(maskContentTransformation); |
129 } | 129 } |
130 | 130 |
131 // Draw the content into the ImageBuffer. | 131 // Draw the content into the ImageBuffer. |
132 for (Node* node = maskElement->firstChild(); node; node = node->nextSibling(
)) { | 132 for (Node* node = maskElement->firstChild(); node; node = node->nextSibling(
)) { |
133 RenderObject* renderer = node->renderer(); | 133 RenderObject* renderer = node->renderer(); |
134 if (!node->isSVGElement() || !toSVGElement(node)->isSVGStyledElement() |
| !renderer) | 134 if (!node->isSVGElement() || !renderer) |
135 continue; | 135 continue; |
136 if (renderer->needsLayout()) | 136 if (renderer->needsLayout()) |
137 return false; | 137 return false; |
138 RenderStyle* style = renderer->style(); | 138 RenderStyle* style = renderer->style(); |
139 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 139 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
140 continue; | 140 continue; |
141 SVGRenderingContext::renderSubtreeToImageBuffer(maskerData->maskImage.ge
t(), renderer, maskContentTransformation); | 141 SVGRenderingContext::renderSubtreeToImageBuffer(maskerData->maskImage.ge
t(), renderer, maskContentTransformation); |
142 } | 142 } |
143 | 143 |
144 maskerData->maskImage->transformColorSpace(ColorSpaceDeviceRGB, colorSpace); | 144 maskerData->maskImage->transformColorSpace(ColorSpaceDeviceRGB, colorSpace); |
145 | 145 |
146 ASSERT(style()); | 146 ASSERT(style()); |
147 ASSERT(style()->svgStyle()); | 147 ASSERT(style()->svgStyle()); |
148 // Create the luminance mask. | 148 // Create the luminance mask. |
149 if (style()->svgStyle()->maskType() == MT_LUMINANCE) | 149 if (style()->svgStyle()->maskType() == MT_LUMINANCE) |
150 maskerData->maskImage->convertToLuminanceMask(); | 150 maskerData->maskImage->convertToLuminanceMask(); |
151 | 151 |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 void RenderSVGResourceMasker::calculateMaskContentRepaintRect() | 155 void RenderSVGResourceMasker::calculateMaskContentRepaintRect() |
156 { | 156 { |
157 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod
e->nextSibling()) { | 157 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod
e->nextSibling()) { |
158 RenderObject* renderer = childNode->renderer(); | 158 RenderObject* renderer = childNode->renderer(); |
159 if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGStyledE
lement() || !renderer) | 159 if (!childNode->isSVGElement() || !renderer) |
160 continue; | 160 continue; |
161 RenderStyle* style = renderer->style(); | 161 RenderStyle* style = renderer->style(); |
162 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 162 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
163 continue; | 163 continue; |
164 m_maskContentBoundaries.unite(renderer->localToParentTransform().mapRect
(renderer->repaintRectInLocalCoordinates())); | 164 m_maskContentBoundaries.unite(renderer->localToParentTransform().mapRect
(renderer->repaintRectInLocalCoordinates())); |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object) | 168 FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object) |
169 { | 169 { |
(...skipping 16 matching lines...) Expand all Loading... |
186 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 186 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
187 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 187 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
188 maskRect = transform.mapRect(maskRect); | 188 maskRect = transform.mapRect(maskRect); |
189 } | 189 } |
190 | 190 |
191 maskRect.intersect(maskBoundaries); | 191 maskRect.intersect(maskBoundaries); |
192 return maskRect; | 192 return maskRect; |
193 } | 193 } |
194 | 194 |
195 } | 195 } |
OLD | NEW |