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

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

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. Created 7 years, 4 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
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 void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool m arkForInvalidation) 64 void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool m arkForInvalidation)
65 { 65 {
66 ASSERT(client); 66 ASSERT(client);
67 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation); 67 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation);
68 } 68 }
69 69
70 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) 70 void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo)
71 { 71 {
72 if (SVGRenderSupport::isOverflowHidden(this)) 72 if (SVGRenderSupport::isOverflowHidden(this))
73 paintInfo.context->clip(m_viewport); 73 paintInfo.getContext()->clip(m_viewport);
74 } 74 }
75 75
76 FloatRect RenderSVGResourceMarker::markerBoundaries(const AffineTransform& marke rTransformation) const 76 FloatRect RenderSVGResourceMarker::markerBoundaries(const AffineTransform& marke rTransformation) const
77 { 77 {
78 FloatRect coordinates = RenderSVGContainer::repaintRectInLocalCoordinates(); 78 FloatRect coordinates = RenderSVGContainer::repaintRectInLocalCoordinates();
79 79
80 // Map repaint rect into parent coordinate space, in which the marker bounda ries have to be evaluated 80 // Map repaint rect into parent coordinate space, in which the marker bounda ries have to be evaluated
81 coordinates = localToParentTransform().mapRect(coordinates); 81 coordinates = localToParentTransform().mapRect(coordinates);
82 82
83 return markerTransformation.mapRect(coordinates); 83 return markerTransformation.mapRect(coordinates);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) 130 void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform)
131 { 131 {
132 // An empty viewBox disables rendering. 132 // An empty viewBox disables rendering.
133 SVGMarkerElement* marker = toSVGMarkerElement(toSVGElement(node())); 133 SVGMarkerElement* marker = toSVGMarkerElement(toSVGElement(node()));
134 ASSERT(marker); 134 ASSERT(marker);
135 if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBoxIsValid() && marker->viewBoxCurrentValue().isEmpty()) 135 if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBoxIsValid() && marker->viewBoxCurrentValue().isEmpty())
136 return; 136 return;
137 137
138 PaintInfo info(paintInfo); 138 PaintInfo info(paintInfo);
139 GraphicsContextStateSaver stateSaver(*info.context); 139 GraphicsContextStateSaver stateSaver(*(info.getContext()));
140 info.applyTransform(transform); 140 info.applyTransform(transform);
141 RenderSVGContainer::paint(info, IntPoint()); 141 RenderSVGContainer::paint(info, IntPoint());
142 } 142 }
143 143
144 AffineTransform RenderSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const 144 AffineTransform RenderSVGResourceMarker::markerContentTransformation(const Affin eTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const
145 { 145 {
146 // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates rela tive to the viewport established by the marker 146 // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates rela tive to the viewport established by the marker
147 FloatPoint mappedOrigin = viewportTransform().mapPoint(origin); 147 FloatPoint mappedOrigin = viewportTransform().mapPoint(origin);
148 148
149 AffineTransform transformation = contentTransformation; 149 AffineTransform transformation = contentTransformation;
(...skipping 20 matching lines...) Expand all
170 SVGMarkerElement* marker = toSVGMarkerElement(node()); 170 SVGMarkerElement* marker = toSVGMarkerElement(node());
171 ASSERT(marker); 171 ASSERT(marker);
172 172
173 SVGLengthContext lengthContext(marker); 173 SVGLengthContext lengthContext(marker);
174 float w = marker->markerWidthCurrentValue().value(lengthContext); 174 float w = marker->markerWidthCurrentValue().value(lengthContext);
175 float h = marker->markerHeightCurrentValue().value(lengthContext); 175 float h = marker->markerHeightCurrentValue().value(lengthContext);
176 m_viewport = FloatRect(0, 0, w, h); 176 m_viewport = FloatRect(0, 0, w, h);
177 } 177 }
178 178
179 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698