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 | |
100 this->predrawNotify(); | |
101 fContentInfo.addOperation(); | 99 fContentInfo.addOperation(); |
102 | 100 |
103 SkASSERT(0 != *size); | 101 SkASSERT(0 != *size); |
104 SkASSERT(((uint8_t) drawType) == drawType); | 102 SkASSERT(((uint8_t) drawType) == drawType); |
105 | 103 |
106 if (0 != (*size & ~MASK_24) || *size == MASK_24) { | 104 if (0 != (*size & ~MASK_24) || *size == MASK_24) { |
107 fWriter.writeInt(PACK_8_24(drawType, MASK_24)); | 105 fWriter.writeInt(PACK_8_24(drawType, MASK_24)); |
108 *size += 1; | 106 *size += 1; |
109 fWriter.writeInt(SkToU32(*size)); | 107 fWriter.writeInt(SkToU32(*size)); |
110 } else { | 108 } else { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 235 |
238 uint32_t fRecordFlags; | 236 uint32_t fRecordFlags; |
239 int fInitialSaveCount; | 237 int fInitialSaveCount; |
240 | 238 |
241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 239 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
242 | 240 |
243 typedef SkCanvas INHERITED; | 241 typedef SkCanvas INHERITED; |
244 }; | 242 }; |
245 | 243 |
246 #endif | 244 #endif |
OLD | NEW |