| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); | 46 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, bool m
arkForInvalidation) | 49 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, bool m
arkForInvalidation) |
| 50 { | 50 { |
| 51 ASSERT(client); | 51 ASSERT(client); |
| 52 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 52 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
| 53 } | 53 } |
| 54 | 54 |
| 55 PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture(Affine
Transform& contentTransformation, const FloatRect& targetBoundingBox, | 55 PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture(Affine
Transform& contentTransformation, const FloatRect& targetBoundingBox, |
| 56 GraphicsContext* context) | 56 GraphicsContext& context) |
| 57 { | 57 { |
| 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); | 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); |
| 59 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 59 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 60 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); | 60 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); |
| 61 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); | 61 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 if (m_maskContentPicture) | 64 if (m_maskContentPicture) |
| 65 return m_maskContentPicture; | 65 return m_maskContentPicture; |
| 66 | 66 |
| 67 SubtreeContentTransformScope contentTransformScope(contentTransformation); | 67 SubtreeContentTransformScope contentTransformScope(contentTransformation); |
| 68 | 68 |
| 69 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection | 69 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
| 70 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 70 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
| 71 // userSpaceOnUse units (http://crbug.com/294900). | 71 // userSpaceOnUse units (http://crbug.com/294900). |
| 72 FloatRect bounds = strokeBoundingBox(); | 72 FloatRect bounds = strokeBoundingBox(); |
| 73 | 73 |
| 74 SkPictureBuilder pictureBuilder(bounds, nullptr, context); | 74 SkPictureBuilder pictureBuilder(bounds, nullptr, &context); |
| 75 | 75 |
| 76 ColorFilter maskContentFilter = style()->svgStyle().colorInterpolation() ==
CI_LINEARRGB | 76 ColorFilter maskContentFilter = style()->svgStyle().colorInterpolation() ==
CI_LINEARRGB |
| 77 ? ColorFilterSRGBToLinearRGB : ColorFilterNone; | 77 ? ColorFilterSRGBToLinearRGB : ColorFilterNone; |
| 78 pictureBuilder.context().setColorFilter(maskContentFilter); | 78 pictureBuilder.context().setColorFilter(maskContentFilter); |
| 79 | 79 |
| 80 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 80 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 81 LayoutObject* layoutObject = childElement->layoutObject(); | 81 LayoutObject* layoutObject = childElement->layoutObject(); |
| 82 if (!layoutObject) | 82 if (!layoutObject) |
| 83 continue; | 83 continue; |
| 84 const ComputedStyle* style = layoutObject->style(); | 84 const ComputedStyle* style = layoutObject->style(); |
| 85 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 85 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 86 continue; | 86 continue; |
| 87 | 87 |
| 88 SVGPaintContext::paintSubtree(&pictureBuilder.context(), layoutObject); | 88 SVGPaintContext::paintSubtree(pictureBuilder.context(), layoutObject); |
| 89 } | 89 } |
| 90 | 90 |
| 91 m_maskContentPicture = pictureBuilder.endRecording(); | 91 m_maskContentPicture = pictureBuilder.endRecording(); |
| 92 return m_maskContentPicture; | 92 return m_maskContentPicture; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void LayoutSVGResourceMasker::calculateMaskContentPaintInvalidationRect() | 95 void LayoutSVGResourceMasker::calculateMaskContentPaintInvalidationRect() |
| 96 { | 96 { |
| 97 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 97 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 98 LayoutObject* layoutObject = childElement->layoutObject(); | 98 LayoutObject* layoutObject = childElement->layoutObject(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 126 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 126 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 127 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 127 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 128 maskRect = transform.mapRect(maskRect); | 128 maskRect = transform.mapRect(maskRect); |
| 129 } | 129 } |
| 130 | 130 |
| 131 maskRect.intersect(maskBoundaries); | 131 maskRect.intersect(maskBoundaries); |
| 132 return maskRect; | 132 return maskRect; |
| 133 } | 133 } |
| 134 | 134 |
| 135 } | 135 } |
| OLD | NEW |