| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 m_masker.set(object, new MaskerData); | 84 m_masker.set(object, new MaskerData); |
| 85 | 85 |
| 86 MaskerData* maskerData = m_masker.get(object); | 86 MaskerData* maskerData = m_masker.get(object); |
| 87 | 87 |
| 88 AffineTransform absoluteTransform; | 88 AffineTransform absoluteTransform; |
| 89 SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(obje
ct, absoluteTransform); | 89 SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(obje
ct, absoluteTransform); |
| 90 | 90 |
| 91 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); | 91 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); |
| 92 | 92 |
| 93 if (!maskerData->maskImage && !repaintRect.isEmpty()) { | 93 if (!maskerData->maskImage && !repaintRect.isEmpty()) { |
| 94 SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); | 94 SVGMaskElement* maskElement = toSVGMaskElement(node()); |
| 95 if (!maskElement) | 95 if (!maskElement) |
| 96 return false; | 96 return false; |
| 97 | 97 |
| 98 ASSERT(style()); | 98 ASSERT(style()); |
| 99 const SVGRenderStyle* svgStyle = style()->svgStyle(); | 99 const SVGRenderStyle* svgStyle = style()->svgStyle(); |
| 100 ASSERT(svgStyle); | 100 ASSERT(svgStyle); |
| 101 ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB ?
ColorSpaceLinearRGB : ColorSpaceDeviceRGB; | 101 ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB ?
ColorSpaceLinearRGB : ColorSpaceDeviceRGB; |
| 102 if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransfo
rm, maskerData->maskImage, Unaccelerated)) | 102 if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransfo
rm, maskerData->maskImage, Unaccelerated)) |
| 103 return false; | 103 return false; |
| 104 | 104 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 { |
| 170 SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); | 170 SVGMaskElement* maskElement = toSVGMaskElement(node()); |
| 171 ASSERT(maskElement); | 171 ASSERT(maskElement); |
| 172 | 172 |
| 173 FloatRect objectBoundingBox = object->objectBoundingBox(); | 173 FloatRect objectBoundingBox = object->objectBoundingBox(); |
| 174 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement
>(maskElement, maskElement->maskUnitsCurrentValue(), objectBoundingBox); | 174 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement
>(maskElement, maskElement->maskUnitsCurrentValue(), objectBoundingBox); |
| 175 | 175 |
| 176 // Resource was not layouted yet. Give back clipping rect of the mask. | 176 // Resource was not layouted yet. Give back clipping rect of the mask. |
| 177 if (selfNeedsLayout()) | 177 if (selfNeedsLayout()) |
| 178 return maskBoundaries; | 178 return maskBoundaries; |
| 179 | 179 |
| 180 if (m_maskContentBoundaries.isEmpty()) | 180 if (m_maskContentBoundaries.isEmpty()) |
| 181 calculateMaskContentRepaintRect(); | 181 calculateMaskContentRepaintRect(); |
| 182 | 182 |
| 183 FloatRect maskRect = m_maskContentBoundaries; | 183 FloatRect maskRect = m_maskContentBoundaries; |
| 184 if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TY
PE_OBJECTBOUNDINGBOX) { | 184 if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TY
PE_OBJECTBOUNDINGBOX) { |
| 185 AffineTransform transform; | 185 AffineTransform transform; |
| 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 |