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

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

Powered by Google App Engine
This is Rietveld 408576698