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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceMarker.cpp

Issue 601093002: Move SVG container paint code to SVGContainerPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval idation : ParentOnlyInvalidation); 64 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval idation : ParentOnlyInvalidation);
65 } 65 }
66 66
67 void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool m arkForInvalidation) 67 void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool m arkForInvalidation)
68 { 68 {
69 ASSERT(client); 69 ASSERT(client);
70 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation); 70 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation);
71 } 71 }
72 72
73 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo)
74 {
75 if (SVGRenderSupport::isOverflowHidden(this))
76 paintInfo.context->clip(m_viewport);
77 }
78
79 FloatRect RenderSVGResourceMarker::markerBoundaries(const AffineTransform& marke rTransformation) const 73 FloatRect RenderSVGResourceMarker::markerBoundaries(const AffineTransform& marke rTransformation) const
80 { 74 {
81 FloatRect coordinates = RenderSVGContainer::paintInvalidationRectInLocalCoor dinates(); 75 FloatRect coordinates = RenderSVGContainer::paintInvalidationRectInLocalCoor dinates();
82 76
83 // Map paint invalidation rect into parent coordinate space, in which the ma rker boundaries have to be evaluated 77 // Map paint invalidation rect into parent coordinate space, in which the ma rker boundaries have to be evaluated
84 coordinates = localToParentTransform().mapRect(coordinates); 78 coordinates = localToParentTransform().mapRect(coordinates);
85 79
86 return markerTransformation.mapRect(coordinates); 80 return markerTransformation.mapRect(coordinates);
87 } 81 }
88 82
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ASSERT(marker); 133 ASSERT(marker);
140 if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBox()->curren tValue()->isValid() && marker->viewBox()->currentValue()->value().isEmpty()) 134 if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBox()->curren tValue()->isValid() && marker->viewBox()->currentValue()->value().isEmpty())
141 return; 135 return;
142 136
143 PaintInfo info(paintInfo); 137 PaintInfo info(paintInfo);
144 GraphicsContextStateSaver stateSaver(*info.context, false); 138 GraphicsContextStateSaver stateSaver(*info.context, false);
145 if (!transform.isIdentity()) { 139 if (!transform.isIdentity()) {
146 stateSaver.save(); 140 stateSaver.save();
147 info.applyTransform(transform, false); 141 info.applyTransform(transform, false);
148 } 142 }
143
144 if (SVGRenderSupport::isOverflowHidden(this))
145 info.context->clip(m_viewport);
fs 2014/09/25 11:00:45 If transform.isIdentity(), this clip could now "le
pdr. 2014/10/08 20:45:31 Previously this code has an isIndentity check a co
fs 2014/10/09 07:02:03 The isIdentity-check just moved into PaintInfo::ap
146
149 RenderSVGContainer::paint(info, IntPoint()); 147 RenderSVGContainer::paint(info, IntPoint());
150 } 148 }
151 149
152 AffineTransform RenderSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const 150 AffineTransform RenderSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const
153 { 151 {
154 // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates rela tive to the viewport established by the marker 152 // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates rela tive to the viewport established by the marker
155 FloatPoint mappedOrigin = viewportTransform().mapPoint(origin); 153 FloatPoint mappedOrigin = viewportTransform().mapPoint(origin);
156 154
157 AffineTransform transformation = contentTransformation; 155 AffineTransform transformation = contentTransformation;
158 if (strokeWidth != -1) 156 if (strokeWidth != -1)
(...skipping 19 matching lines...) Expand all
178 SVGMarkerElement* marker = toSVGMarkerElement(element()); 176 SVGMarkerElement* marker = toSVGMarkerElement(element());
179 ASSERT(marker); 177 ASSERT(marker);
180 178
181 SVGLengthContext lengthContext(marker); 179 SVGLengthContext lengthContext(marker);
182 float w = marker->markerWidth()->currentValue()->value(lengthContext); 180 float w = marker->markerWidth()->currentValue()->value(lengthContext);
183 float h = marker->markerHeight()->currentValue()->value(lengthContext); 181 float h = marker->markerHeight()->currentValue()->value(lengthContext);
184 m_viewport = FloatRect(0, 0, w, h); 182 m_viewport = FloatRect(0, 0, w, h);
185 } 183 }
186 184
187 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698