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

Side by Side Diff: Source/core/svg/SVGPathElement.cpp

Issue 751323002: Simplify SVGPathByteStream-based path-query functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | « no previous file | Source/core/svg/SVGPathUtilities.h » ('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) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 { 61 {
62 visitor->trace(m_pathLength); 62 visitor->trace(m_pathLength);
63 visitor->trace(m_pathSegList); 63 visitor->trace(m_pathSegList);
64 SVGGeometryElement::trace(visitor); 64 SVGGeometryElement::trace(visitor);
65 } 65 }
66 66
67 DEFINE_NODE_FACTORY(SVGPathElement) 67 DEFINE_NODE_FACTORY(SVGPathElement)
68 68
69 float SVGPathElement::getTotalLength() 69 float SVGPathElement::getTotalLength()
70 { 70 {
71 float totalLength = 0; 71 return getTotalLengthOfSVGPathByteStream(*pathByteStream());
72 getTotalLengthOfSVGPathByteStream(*pathByteStream(), totalLength);
73 return totalLength;
74 } 72 }
75 73
76 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength) 74 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength)
77 { 75 {
78 FloatPoint point; 76 FloatPoint point = getPointAtLengthOfSVGPathByteStream(*pathByteStream(), le ngth);
79 getPointAtLengthOfSVGPathByteStream(*pathByteStream(), length, point);
80 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); 77 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val);
81 } 78 }
82 79
83 unsigned SVGPathElement::getPathSegAtLength(float length) 80 unsigned SVGPathElement::getPathSegAtLength(float length)
84 { 81 {
85 unsigned pathSeg = 0; 82 return getSVGPathSegAtLengthFromSVGPathByteStream(*pathByteStream(), length) ;
86 getSVGPathSegAtLengthFromSVGPathByteStream(*pathByteStream(), length, pathSe g);
87 return pathSeg;
88 } 83 }
89 84
90 PassRefPtrWillBeRawPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClos ePath() 85 PassRefPtrWillBeRawPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClos ePath()
91 { 86 {
92 return SVGPathSegClosePath::create(0); 87 return SVGPathSegClosePath::create(0);
93 } 88 }
94 89
95 PassRefPtrWillBeRawPtr<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMove toAbs(float x, float y) 90 PassRefPtrWillBeRawPtr<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMove toAbs(float x, float y)
96 { 91 {
97 return SVGPathSegMovetoAbs::create(0, x, y); 92 return SVGPathSegMovetoAbs::create(0, x, y);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 280
286 // FIXME: Eventually we should support getBBox for detached elements. 281 // FIXME: Eventually we should support getBBox for detached elements.
287 if (!renderer()) 282 if (!renderer())
288 return FloatRect(); 283 return FloatRect();
289 284
290 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 285 RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
291 return renderer->path().boundingRect(); 286 return renderer->path().boundingRect();
292 } 287 }
293 288
294 } // namespace blink 289 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/svg/SVGPathUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698