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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.cpp

Issue 1527613006: Use Vector<...>::append(const U*, size_t) in SVGPathByteStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathByteStream.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 18 matching lines...) Expand all
29 // Helper class that coalesces writes to a SVGPathByteStream to a local buffer. 29 // Helper class that coalesces writes to a SVGPathByteStream to a local buffer.
30 class CoalescingBuffer { 30 class CoalescingBuffer {
31 public: 31 public:
32 CoalescingBuffer(SVGPathByteStream& byteStream) 32 CoalescingBuffer(SVGPathByteStream& byteStream)
33 : m_currentOffset(0) 33 : m_currentOffset(0)
34 , m_byteStream(byteStream) 34 , m_byteStream(byteStream)
35 { 35 {
36 } 36 }
37 ~CoalescingBuffer() 37 ~CoalescingBuffer()
38 { 38 {
39 for (size_t i = 0; i < m_currentOffset; ++i) 39 m_byteStream.append(m_bytes, m_currentOffset);
40 m_byteStream.append(m_bytes[i]);
41 } 40 }
42 41
43 template<typename DataType> 42 template<typename DataType>
44 void writeType(DataType value) 43 void writeType(DataType value)
45 { 44 {
46 ByteType<DataType> data; 45 ByteType<DataType> data;
47 data.value = value; 46 data.value = value;
48 size_t typeSize = sizeof(ByteType<DataType>); 47 size_t typeSize = sizeof(ByteType<DataType>);
49 ASSERT(m_currentOffset + typeSize <= sizeof(m_bytes)); 48 ASSERT(m_currentOffset + typeSize <= sizeof(m_bytes));
50 memcpy(m_bytes + m_currentOffset, data.bytes, typeSize); 49 memcpy(m_bytes + m_currentOffset, data.bytes, typeSize);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 buffer.writeFlag(segment.arcLarge); 119 buffer.writeFlag(segment.arcLarge);
121 buffer.writeFlag(segment.arcSweep); 120 buffer.writeFlag(segment.arcSweep);
122 buffer.writeFloatPoint(segment.targetPoint); 121 buffer.writeFloatPoint(segment.targetPoint);
123 break; 122 break;
124 default: 123 default:
125 ASSERT_NOT_REACHED(); 124 ASSERT_NOT_REACHED();
126 } 125 }
127 } 126 }
128 127
129 } // namespace blink 128 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathByteStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698