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

Side by Side Diff: Source/core/svg/SVGPathByteStreamBuilder.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/SVGPathByteStream.h ('k') | Source/core/svg/SVGPathByteStreamSource.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) 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 virtual void closePath() OVERRIDE; 46 virtual void closePath() OVERRIDE;
47 47
48 // Only used in UnalteredParsing mode. 48 // Only used in UnalteredParsing mode.
49 virtual void lineToHorizontal(float, PathCoordinateMode) OVERRIDE; 49 virtual void lineToHorizontal(float, PathCoordinateMode) OVERRIDE;
50 virtual void lineToVertical(float, PathCoordinateMode) OVERRIDE; 50 virtual void lineToVertical(float, PathCoordinateMode) OVERRIDE;
51 virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCo ordinateMode) OVERRIDE; 51 virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCo ordinateMode) OVERRIDE;
52 virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoor dinateMode) OVERRIDE; 52 virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoor dinateMode) OVERRIDE;
53 virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) O VERRIDE; 53 virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) O VERRIDE;
54 virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, c onst FloatPoint&, PathCoordinateMode) OVERRIDE; 54 virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, c onst FloatPoint&, PathCoordinateMode) OVERRIDE;
55 55
56 template<typename ByteType> 56 template<typename DataType>
57 void writeType(const ByteType& type) 57 void writeType(DataType value)
58 { 58 {
59 size_t typeSize = sizeof(ByteType); 59 ByteType<DataType> data;
60 data.value = value;
61 size_t typeSize = sizeof(ByteType<DataType>);
60 for (size_t i = 0; i < typeSize; ++i) 62 for (size_t i = 0; i < typeSize; ++i)
61 m_byteStream->append(type.bytes[i]); 63 m_byteStream->append(data.bytes[i]);
62 } 64 }
63 65
64 void writeFlag(bool value) 66 void writeFlag(bool value) { writeType<bool>(value); }
65 { 67 void writeFloat(float value) { writeType<float>(value); }
66 BoolByte data;
67 data.value = value;
68 writeType(data);
69 }
70
71 void writeFloat(float value)
72 {
73 FloatByte data;
74 data.value = value;
75 writeType(data);
76 }
77
78 void writeFloatPoint(const FloatPoint& point) 68 void writeFloatPoint(const FloatPoint& point)
79 { 69 {
80 writeFloat(point.x()); 70 writeType<float>(point.x());
81 writeFloat(point.y()); 71 writeType<float>(point.y());
82 } 72 }
83 73 void writeSegmentType(unsigned short value) { writeType<unsigned short>(valu e); }
84 void writeSegmentType(unsigned short value)
85 {
86 UnsignedShortByte data;
87 data.value = value;
88 writeType(data);
89 }
90 74
91 SVGPathByteStream* m_byteStream; 75 SVGPathByteStream* m_byteStream;
92 }; 76 };
93 77
94 } // namespace WebCore 78 } // namespace WebCore
95 79
96 #endif // SVGPathByteStreamBuilder_h 80 #endif // SVGPathByteStreamBuilder_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPathByteStream.h ('k') | Source/core/svg/SVGPathByteStreamSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698