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

Side by Side Diff: Source/core/svg/SVGPathByteStreamSource.h

Issue 130563014: Get rid of the *Byte types used for (de)serializing to SVGPathByteStream (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGPathByteStreamBuilder.h ('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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual bool parseLineToVerticalSegment(float&) OVERRIDE; 48 virtual bool parseLineToVerticalSegment(float&) OVERRIDE;
49 virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) OVERRIDE; 49 virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) OVERRIDE;
50 virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) OVERRI DE; 50 virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) OVERRI DE;
51 virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) OVERRIDE ; 51 virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) OVERRIDE ;
52 virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&) OVERRIDE; 52 virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&) OVERRIDE;
53 virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPo int&) OVERRIDE; 53 virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPo int&) OVERRIDE;
54 54
55 #if COMPILER(MSVC) 55 #if COMPILER(MSVC)
56 #pragma warning(disable: 4701) 56 #pragma warning(disable: 4701)
57 #endif 57 #endif
58 template<typename DataType, typename ByteType> 58 template<typename DataType>
59 DataType readType() 59 DataType readType()
60 { 60 {
61 ByteType data; 61 ByteType<DataType> data;
62 size_t typeSize = sizeof(ByteType); 62 size_t typeSize = sizeof(ByteType<DataType>);
63 63
64 for (size_t i = 0; i < typeSize; ++i) { 64 for (size_t i = 0; i < typeSize; ++i) {
65 ASSERT(m_streamCurrent < m_streamEnd); 65 ASSERT(m_streamCurrent < m_streamEnd);
66 data.bytes[i] = *m_streamCurrent; 66 data.bytes[i] = *m_streamCurrent;
67 ++m_streamCurrent; 67 ++m_streamCurrent;
68 } 68 }
69 69
70 return data.value; 70 return data.value;
71 } 71 }
72 72
73 bool readFlag() 73 bool readFlag() { return readType<bool>(); }
74 { 74 float readFloat() { return readType<float>(); }
75 return readType<bool, BoolByte>(); 75 unsigned short readSVGSegmentType() { return readType<unsigned short>(); }
76 }
77
78 float readFloat()
79 {
80 return readType<float, FloatByte>();
81 }
82
83 unsigned short readSVGSegmentType()
84 {
85 return readType<unsigned short, UnsignedShortByte>();
86 }
87
88 FloatPoint readFloatPoint() 76 FloatPoint readFloatPoint()
89 { 77 {
90 float x = readType<float, FloatByte>(); 78 float x = readType<float>();
91 float y = readType<float, FloatByte>(); 79 float y = readType<float>();
92 return FloatPoint(x, y); 80 return FloatPoint(x, y);
93 } 81 }
94 82
95 SVGPathByteStream::DataIterator m_streamCurrent; 83 SVGPathByteStream::DataIterator m_streamCurrent;
96 SVGPathByteStream::DataIterator m_streamEnd; 84 SVGPathByteStream::DataIterator m_streamEnd;
97 }; 85 };
98 86
99 } // namespace WebCore 87 } // namespace WebCore
100 88
101 #endif // SVGPathByteStreamSource_h 89 #endif // SVGPathByteStreamSource_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPathByteStreamBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698