| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 80 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
GraphicsContext*& context, unsigned short resourceMode) | 83 bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
GraphicsContext*& context, unsigned short resourceMode) |
| 84 { | 84 { |
| 85 ASSERT(object); | 85 ASSERT(object); |
| 86 ASSERT(context); | 86 ASSERT(context); |
| 87 ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode); | 87 ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode); |
| 88 | 88 |
| 89 if (!m_masker.contains(object)) | 89 bool missingMaskerData = !m_masker.contains(object); |
| 90 if (missingMaskerData) |
| 90 m_masker.set(object, new MaskerData); | 91 m_masker.set(object, new MaskerData); |
| 91 | 92 |
| 92 MaskerData* maskerData = m_masker.get(object); | 93 MaskerData* maskerData = m_masker.get(object); |
| 93 | 94 |
| 94 AffineTransform absoluteTransform; | 95 AffineTransform absoluteTransform; |
| 95 SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(o
bject, absoluteTransform); | 96 SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(o
bject, absoluteTransform); |
| 96 | 97 |
| 97 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); | 98 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); |
| 98 | 99 |
| 99 if (!maskerData->maskImage && !repaintRect.isEmpty()) { | 100 if (!maskerData->maskImage && !repaintRect.isEmpty()) { |
| 100 SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); | 101 SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); |
| 101 if (!maskElement) | 102 if (!maskElement) |
| 102 return false; | 103 return false; |
| 103 | 104 |
| 104 ASSERT(style()); | 105 ASSERT(style()); |
| 105 const SVGRenderStyle* svgStyle = style()->svgStyle(); | 106 const SVGRenderStyle* svgStyle = style()->svgStyle(); |
| 106 ASSERT(svgStyle); | 107 ASSERT(svgStyle); |
| 107 ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB ?
ColorSpaceLinearRGB : ColorSpaceDeviceRGB; | 108 ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB ?
ColorSpaceLinearRGB : ColorSpaceDeviceRGB; |
| 108 if (!SVGImageBufferTools::createImageBuffer(repaintRect, absoluteTransfo
rm, maskerData->maskImage, colorSpace, Unaccelerated)) | 109 if (!SVGImageBufferTools::createImageBuffer(repaintRect, absoluteTransfo
rm, maskerData->maskImage, colorSpace, Unaccelerated)) |
| 109 return false; | 110 return false; |
| 110 | 111 |
| 111 if (!drawContentIntoMaskImage(maskerData, colorSpace, maskElement, objec
t)) { | 112 if (!drawContentIntoMaskImage(maskerData, colorSpace, maskElement, objec
t)) { |
| 112 maskerData->maskImage.clear(); | 113 maskerData->maskImage.clear(); |
| 113 } | 114 } |
| 114 } | 115 } |
| 115 | 116 |
| 116 if (!maskerData->maskImage) | 117 if (!maskerData->maskImage) |
| 117 return false; | 118 return false; |
| 118 | 119 |
| 119 SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRe
ct, maskerData->maskImage); | 120 SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRe
ct, maskerData->maskImage, missingMaskerData); |
| 120 return true; | 121 return true; |
| 121 } | 122 } |
| 122 | 123 |
| 123 bool RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, C
olorSpace colorSpace, const SVGMaskElement* maskElement, RenderObject* object) | 124 bool RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, C
olorSpace colorSpace, const SVGMaskElement* maskElement, RenderObject* object) |
| 124 { | 125 { |
| 125 GraphicsContext* maskImageContext = maskerData->maskImage->context(); | 126 GraphicsContext* maskImageContext = maskerData->maskImage->context(); |
| 126 ASSERT(maskImageContext); | 127 ASSERT(maskImageContext); |
| 127 | 128 |
| 128 // Eventually adjust the mask image context according to the target objectBo
undingBox. | 129 // Eventually adjust the mask image context according to the target objectBo
undingBox. |
| 129 AffineTransform maskContentTransformation; | 130 AffineTransform maskContentTransformation; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 maskRect = transform.mapRect(maskRect); | 195 maskRect = transform.mapRect(maskRect); |
| 195 } | 196 } |
| 196 | 197 |
| 197 maskRect.intersect(maskBoundaries); | 198 maskRect.intersect(maskBoundaries); |
| 198 return maskRect; | 199 return maskRect; |
| 199 } | 200 } |
| 200 | 201 |
| 201 } | 202 } |
| 202 | 203 |
| 203 #endif // ENABLE(SVG) | 204 #endif // ENABLE(SVG) |
| OLD | NEW |