~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/svg/SVGPathByteStreamSource.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 */
 
19
 
 
20
#include "config.h"
 
21
 
 
22
#if ENABLE(SVG)
 
23
#include "SVGPathByteStreamSource.h"
 
24
 
 
25
namespace WebCore {
 
26
 
 
27
SVGPathByteStreamSource::SVGPathByteStreamSource(SVGPathByteStream* stream)
 
28
{
 
29
    ASSERT(stream);
 
30
    m_streamCurrent = stream->begin();
 
31
    m_streamEnd = stream->end();
 
32
}
 
33
 
 
34
bool SVGPathByteStreamSource::hasMoreData() const
 
35
{
 
36
    return m_streamCurrent < m_streamEnd;
 
37
}
 
38
 
 
39
bool SVGPathByteStreamSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
 
40
{
 
41
    pathSegType = static_cast<SVGPathSegType>(readSVGSegmentType());
 
42
    return true;
 
43
}
 
44
 
 
45
SVGPathSegType SVGPathByteStreamSource::nextCommand(SVGPathSegType)
 
46
{
 
47
    return static_cast<SVGPathSegType>(readSVGSegmentType());
 
48
}
 
49
 
 
50
bool SVGPathByteStreamSource::parseMoveToSegment(FloatPoint& targetPoint)
 
51
{
 
52
    targetPoint = readFloatPoint();
 
53
    return true;
 
54
}
 
55
 
 
56
bool SVGPathByteStreamSource::parseLineToSegment(FloatPoint& targetPoint)
 
57
{
 
58
    targetPoint = readFloatPoint();
 
59
    return true;
 
60
}
 
61
 
 
62
bool SVGPathByteStreamSource::parseLineToHorizontalSegment(float& x)
 
63
{
 
64
    x = readFloat();
 
65
    return true;
 
66
}
 
67
 
 
68
bool SVGPathByteStreamSource::parseLineToVerticalSegment(float& y)
 
69
{
 
70
    y = readFloat();
 
71
    return true;
 
72
}
 
73
 
 
74
bool SVGPathByteStreamSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
 
75
{
 
76
    point1 = readFloatPoint();
 
77
    point2 = readFloatPoint();
 
78
    targetPoint = readFloatPoint();
 
79
    return true;
 
80
}
 
81
 
 
82
bool SVGPathByteStreamSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
 
83
{
 
84
    point2 = readFloatPoint();
 
85
    targetPoint = readFloatPoint();
 
86
    return true;
 
87
}
 
88
 
 
89
bool SVGPathByteStreamSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
 
90
{
 
91
    point1 = readFloatPoint();
 
92
    targetPoint = readFloatPoint();
 
93
    return true;
 
94
}
 
95
 
 
96
bool SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
 
97
{
 
98
    targetPoint = readFloatPoint();
 
99
    return true;
 
100
}
 
101
 
 
102
bool SVGPathByteStreamSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
 
103
{
 
104
    rx = readFloat();
 
105
    ry = readFloat();
 
106
    angle = readFloat();
 
107
    largeArc = readFlag();
 
108
    sweep = readFlag();
 
109
    targetPoint = readFloatPoint();
 
110
    return true;
 
111
}
 
112
 
 
113
}
 
114
 
 
115
#endif // ENABLE(SVG)