OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 * Returns the start offset of the chunk. This is the location at which | 89 * Returns the start offset of the chunk. This is the location at which |
90 * the opcode & size are stored. | 90 * the opcode & size are stored. |
91 * TODO: since we are handing the size into here we could call reserve | 91 * TODO: since we are handing the size into here we could call reserve |
92 * and then return a pointer to the memory storage. This could decrease | 92 * and then return a pointer to the memory storage. This could decrease |
93 * allocation overhead but could lead to more wasted space (the tail | 93 * allocation overhead but could lead to more wasted space (the tail |
94 * end of blocks could go unused). Possibly add a second addDraw that | 94 * end of blocks could go unused). Possibly add a second addDraw that |
95 * operates in this manner. | 95 * operates in this manner. |
96 */ | 96 */ |
97 size_t addDraw(DrawType drawType, size_t* size) { | 97 size_t addDraw(DrawType drawType, size_t* size) { |
98 size_t offset = fWriter.bytesWritten(); | 98 size_t offset = fWriter.bytesWritten(); |
99 | 99 //TODO: CHECK. |
100 this->predrawNotify(); | 100 //this->predrawNotify(); |
101 fContentInfo.addOperation(); | 101 fContentInfo.addOperation(); |
102 | 102 |
103 SkASSERT(0 != *size); | 103 SkASSERT(0 != *size); |
104 SkASSERT(((uint8_t) drawType) == drawType); | 104 SkASSERT(((uint8_t) drawType) == drawType); |
105 | 105 |
106 if (0 != (*size & ~MASK_24) || *size == MASK_24) { | 106 if (0 != (*size & ~MASK_24) || *size == MASK_24) { |
107 fWriter.writeInt(PACK_8_24(drawType, MASK_24)); | 107 fWriter.writeInt(PACK_8_24(drawType, MASK_24)); |
108 *size += 1; | 108 *size += 1; |
109 fWriter.writeInt(SkToU32(*size)); | 109 fWriter.writeInt(SkToU32(*size)); |
110 } else { | 110 } else { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 uint32_t fRecordFlags; | 238 uint32_t fRecordFlags; |
239 int fInitialSaveCount; | 239 int fInitialSaveCount; |
240 | 240 |
241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
242 | 242 |
243 typedef SkCanvas INHERITED; | 243 typedef SkCanvas INHERITED; |
244 }; | 244 }; |
245 | 245 |
246 #endif | 246 #endif |
OLD | NEW |