2
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public License
15
* along with this library; see the file COPYING.LIB. If not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
23
#include "SVGPathByteStreamSource.h"
27
SVGPathByteStreamSource::SVGPathByteStreamSource(SVGPathByteStream* stream)
30
m_streamCurrent = stream->begin();
31
m_streamEnd = stream->end();
34
bool SVGPathByteStreamSource::hasMoreData() const
36
return m_streamCurrent < m_streamEnd;
39
bool SVGPathByteStreamSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
41
pathSegType = static_cast<SVGPathSegType>(readSVGSegmentType());
45
SVGPathSegType SVGPathByteStreamSource::nextCommand(SVGPathSegType)
47
return static_cast<SVGPathSegType>(readSVGSegmentType());
50
bool SVGPathByteStreamSource::parseMoveToSegment(FloatPoint& targetPoint)
52
targetPoint = readFloatPoint();
56
bool SVGPathByteStreamSource::parseLineToSegment(FloatPoint& targetPoint)
58
targetPoint = readFloatPoint();
62
bool SVGPathByteStreamSource::parseLineToHorizontalSegment(float& x)
68
bool SVGPathByteStreamSource::parseLineToVerticalSegment(float& y)
74
bool SVGPathByteStreamSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
76
point1 = readFloatPoint();
77
point2 = readFloatPoint();
78
targetPoint = readFloatPoint();
82
bool SVGPathByteStreamSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
84
point2 = readFloatPoint();
85
targetPoint = readFloatPoint();
89
bool SVGPathByteStreamSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
91
point1 = readFloatPoint();
92
targetPoint = readFloatPoint();
96
bool SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
98
targetPoint = readFloatPoint();
102
bool SVGPathByteStreamSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
107
largeArc = readFlag();
109
targetPoint = readFloatPoint();
115
#endif // ENABLE(SVG)