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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGPathByteStream.h ('k') | Source/core/svg/SVGPathByteStreamSource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPathByteStreamBuilder.h
diff --git a/Source/core/svg/SVGPathByteStreamBuilder.h b/Source/core/svg/SVGPathByteStreamBuilder.h
index 66d754bc92bd39071f2da3d03678f629653707d0..759ebc7ac3e43037375efe70f5268fd4114942e3 100644
--- a/Source/core/svg/SVGPathByteStreamBuilder.h
+++ b/Source/core/svg/SVGPathByteStreamBuilder.h
@@ -53,40 +53,24 @@ private:
virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) OVERRIDE;
virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) OVERRIDE;
- template<typename ByteType>
- void writeType(const ByteType& type)
+ template<typename DataType>
+ void writeType(DataType value)
{
- size_t typeSize = sizeof(ByteType);
- for (size_t i = 0; i < typeSize; ++i)
- m_byteStream->append(type.bytes[i]);
- }
-
- void writeFlag(bool value)
- {
- BoolByte data;
+ ByteType<DataType> data;
data.value = value;
- writeType(data);
- }
-
- void writeFloat(float value)
- {
- FloatByte data;
- data.value = value;
- writeType(data);
+ size_t typeSize = sizeof(ByteType<DataType>);
+ for (size_t i = 0; i < typeSize; ++i)
+ m_byteStream->append(data.bytes[i]);
}
+ void writeFlag(bool value) { writeType<bool>(value); }
+ void writeFloat(float value) { writeType<float>(value); }
void writeFloatPoint(const FloatPoint& point)
{
- writeFloat(point.x());
- writeFloat(point.y());
- }
-
- void writeSegmentType(unsigned short value)
- {
- UnsignedShortByte data;
- data.value = value;
- writeType(data);
+ writeType<float>(point.x());
+ writeType<float>(point.y());
}
+ void writeSegmentType(unsigned short value) { writeType<unsigned short>(value); }
SVGPathByteStream* m_byteStream;
};
« 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