Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: Source/core/layout/svg/LayoutSVGResourceMasker.cpp

Issue 1160183003: Use SkPictureBuilder in SVGShapePainter, and generalize SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourceMasker.h ('k') | Source/core/paint/SVGClipPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 m_maskContentBoundaries = FloatRect(); 45 m_maskContentBoundaries = FloatRect();
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 { 57 {
57 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo ntentUnits()->currentValue()->enumValue(); 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo ntentUnits()->currentValue()->enumValue();
58 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 59 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
59 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y()); 60 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
60 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height()); 61 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
61 } 62 }
62 63
63 if (m_maskContentPicture) 64 if (m_maskContentPicture)
64 return m_maskContentPicture; 65 return m_maskContentPicture;
65 66
66 SubtreeContentTransformScope contentTransformScope(contentTransformation); 67 SubtreeContentTransformScope contentTransformScope(contentTransformation);
67 68
68 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 69 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
69 // 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
70 // userSpaceOnUse units (http://crbug.com/294900). 71 // userSpaceOnUse units (http://crbug.com/294900).
71 FloatRect bounds = strokeBoundingBox(); 72 FloatRect bounds = strokeBoundingBox();
72 73
73 SkPictureBuilder pictureBuilder(bounds); 74 SkPictureBuilder pictureBuilder(bounds, nullptr, context);
74 75
75 ColorFilter maskContentFilter = style()->svgStyle().colorInterpolation() == CI_LINEARRGB 76 ColorFilter maskContentFilter = style()->svgStyle().colorInterpolation() == CI_LINEARRGB
76 ? ColorFilterSRGBToLinearRGB : ColorFilterNone; 77 ? ColorFilterSRGBToLinearRGB : ColorFilterNone;
77 pictureBuilder.context().setColorFilter(maskContentFilter); 78 pictureBuilder.context().setColorFilter(maskContentFilter);
78 79
79 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 )) {
80 LayoutObject* layoutObject = childElement->layoutObject(); 81 LayoutObject* layoutObject = childElement->layoutObject();
81 if (!layoutObject) 82 if (!layoutObject)
82 continue; 83 continue;
83 const ComputedStyle* style = layoutObject->style(); 84 const ComputedStyle* style = layoutObject->style();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 126 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
126 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 127 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
127 maskRect = transform.mapRect(maskRect); 128 maskRect = transform.mapRect(maskRect);
128 } 129 }
129 130
130 maskRect.intersect(maskBoundaries); 131 maskRect.intersect(maskBoundaries);
131 return maskRect; 132 return maskRect;
132 } 133 }
133 134
134 } 135 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourceMasker.h ('k') | Source/core/paint/SVGClipPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698