OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkWriteBuffer.h" | 8 #include "SkWriteBuffer.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void SkWriteBuffer::writeByteArray(const void* data, size_t size) { | 41 void SkWriteBuffer::writeByteArray(const void* data, size_t size) { |
42 fWriter.write32(SkToU32(size)); | 42 fWriter.write32(SkToU32(size)); |
43 fWriter.writePad(data, size); | 43 fWriter.writePad(data, size); |
44 } | 44 } |
45 | 45 |
46 void SkWriteBuffer::writeBool(bool value) { | 46 void SkWriteBuffer::writeBool(bool value) { |
47 fWriter.writeBool(value); | 47 fWriter.writeBool(value); |
48 } | 48 } |
49 | 49 |
50 void SkWriteBuffer::writeFixed(SkFixed value) { | |
51 fWriter.write32(value); | |
52 } | |
53 | |
54 void SkWriteBuffer::writeScalar(SkScalar value) { | 50 void SkWriteBuffer::writeScalar(SkScalar value) { |
55 fWriter.writeScalar(value); | 51 fWriter.writeScalar(value); |
56 } | 52 } |
57 | 53 |
58 void SkWriteBuffer::writeScalarArray(const SkScalar* value, uint32_t count) { | 54 void SkWriteBuffer::writeScalarArray(const SkScalar* value, uint32_t count) { |
59 fWriter.write32(count); | 55 fWriter.write32(count); |
60 fWriter.write(value, count * sizeof(SkScalar)); | 56 fWriter.write(value, count * sizeof(SkScalar)); |
61 } | 57 } |
62 | 58 |
63 void SkWriteBuffer::writeInt(int32_t value) { | 59 void SkWriteBuffer::writeInt(int32_t value) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // make room for the size of the flattened object | 326 // make room for the size of the flattened object |
331 (void)fWriter.reserve(sizeof(uint32_t)); | 327 (void)fWriter.reserve(sizeof(uint32_t)); |
332 // record the current size, so we can subtract after the object writes. | 328 // record the current size, so we can subtract after the object writes. |
333 size_t offset = fWriter.bytesWritten(); | 329 size_t offset = fWriter.bytesWritten(); |
334 // now flatten the object | 330 // now flatten the object |
335 flattenable->flatten(*this); | 331 flattenable->flatten(*this); |
336 size_t objSize = fWriter.bytesWritten() - offset; | 332 size_t objSize = fWriter.bytesWritten() - offset; |
337 // record the obj's size | 333 // record the obj's size |
338 fWriter.overwriteTAt(offset - sizeof(uint32_t), SkToU32(objSize)); | 334 fWriter.overwriteTAt(offset - sizeof(uint32_t), SkToU32(objSize)); |
339 } | 335 } |
OLD | NEW |