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

Side by Side Diff: Source/core/rendering/svg/SVGMarkerData.h

Issue 678863002: Move SVG shape painting code to SVGShapePainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update per reviewer comments Created 6 years, 1 month 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/rendering/svg/RenderSVGShape.cpp ('k') | no next file » | 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 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 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 27 matching lines...) Expand all
38 , origin(useOrigin) 38 , origin(useOrigin)
39 , angle(useAngle) 39 , angle(useAngle)
40 { 40 {
41 } 41 }
42 42
43 SVGMarkerType type; 43 SVGMarkerType type;
44 FloatPoint origin; 44 FloatPoint origin;
45 float angle; 45 float angle;
46 }; 46 };
47 47
48 class RenderSVGResourceMarker;
49
48 class SVGMarkerData { 50 class SVGMarkerData {
49 public: 51 public:
50 SVGMarkerData(Vector<MarkerPosition>& positions, bool autoStartReverse) 52 SVGMarkerData(Vector<MarkerPosition>& positions, bool autoStartReverse)
51 : m_positions(positions) 53 : m_positions(positions)
52 , m_elementIndex(0) 54 , m_elementIndex(0)
53 , m_autoStartReverse(autoStartReverse) 55 , m_autoStartReverse(autoStartReverse)
54 { 56 {
55 } 57 }
56 58
57 static void updateFromPathElement(void* info, const PathElement* element) 59 static void updateFromPathElement(void* info, const PathElement* element)
(...skipping 12 matching lines...) Expand all
70 // Update our marker data for this element. 72 // Update our marker data for this element.
71 markerData->updateMarkerDataForPathElement(element); 73 markerData->updateMarkerDataForPathElement(element);
72 ++markerData->m_elementIndex; 74 ++markerData->m_elementIndex;
73 } 75 }
74 76
75 void pathIsDone() 77 void pathIsDone()
76 { 78 {
77 m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndM arker))); 79 m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndM arker)));
78 } 80 }
79 81
82 static inline RenderSVGResourceMarker* markerForType(const SVGMarkerType& ty pe, RenderSVGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, Re nderSVGResourceMarker* markerEnd)
83 {
84 switch (type) {
85 case StartMarker:
86 return markerStart;
87 case MidMarker:
88 return markerMid;
89 case EndMarker:
90 return markerEnd;
91 }
92
93 ASSERT_NOT_REACHED();
94 return 0;
95 }
96
80 private: 97 private:
81 float currentAngle(SVGMarkerType type) const 98 float currentAngle(SVGMarkerType type) const
82 { 99 {
83 // For details of this calculation, see: http://www.w3.org/TR/SVG/single -page.html#painting-MarkerElement 100 // For details of this calculation, see: http://www.w3.org/TR/SVG/single -page.html#painting-MarkerElement
84 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]); 101 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]);
85 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]); 102 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]);
86 103
87 double inAngle = rad2deg(inSlope.slopeAngleRadians()); 104 double inAngle = rad2deg(inSlope.slopeAngleRadians());
88 double outAngle = rad2deg(outSlope.slopeAngleRadians()); 105 double outAngle = rad2deg(outSlope.slopeAngleRadians());
89 106
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 FloatPoint m_origin; 166 FloatPoint m_origin;
150 FloatPoint m_subpathStart; 167 FloatPoint m_subpathStart;
151 FloatPoint m_inslopePoints[2]; 168 FloatPoint m_inslopePoints[2];
152 FloatPoint m_outslopePoints[2]; 169 FloatPoint m_outslopePoints[2];
153 bool m_autoStartReverse; 170 bool m_autoStartReverse;
154 }; 171 };
155 172
156 } 173 }
157 174
158 #endif // SVGMarkerData_h 175 #endif // SVGMarkerData_h
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698