OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 * can potentially be increased if the chunk size needs its own storage | 123 * can potentially be increased if the chunk size needs its own storage |
124 * location (i.e., it overflows 24 bits). | 124 * location (i.e., it overflows 24 bits). |
125 * Returns the start offset of the chunk. This is the location at which | 125 * Returns the start offset of the chunk. This is the location at which |
126 * the opcode & size are stored. | 126 * the opcode & size are stored. |
127 * TODO: since we are handing the size into here we could call reserve | 127 * TODO: since we are handing the size into here we could call reserve |
128 * and then return a pointer to the memory storage. This could decrease | 128 * and then return a pointer to the memory storage. This could decrease |
129 * allocation overhead but could lead to more wasted space (the tail | 129 * allocation overhead but could lead to more wasted space (the tail |
130 * end of blocks could go unused). Possibly add a second addDraw that | 130 * end of blocks could go unused). Possibly add a second addDraw that |
131 * operates in this manner. | 131 * operates in this manner. |
132 */ | 132 */ |
133 uint32_t addDraw(DrawType drawType, uint32_t* size) { | 133 size_t addDraw(DrawType drawType, uint32_t* size) { |
134 uint32_t offset = fWriter.size(); | 134 size_t offset = fWriter.size(); |
135 | 135 |
136 this->predrawNotify(); | 136 this->predrawNotify(); |
137 | 137 |
138 #ifdef SK_DEBUG_TRACE | 138 #ifdef SK_DEBUG_TRACE |
139 SkDebugf("add %s\n", DrawTypeToString(drawType)); | 139 SkDebugf("add %s\n", DrawTypeToString(drawType)); |
140 #endif | 140 #endif |
141 | 141 |
142 SkASSERT(0 != *size); | 142 SkASSERT(0 != *size); |
143 SkASSERT(((uint8_t) drawType) == drawType); | 143 SkASSERT(((uint8_t) drawType) == drawType); |
144 | 144 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int paths(size_t* size) const; | 195 int paths(size_t* size) const; |
196 int regions(size_t* size) const; | 196 int regions(size_t* size) const; |
197 size_t streamlen() const; | 197 size_t streamlen() const; |
198 | 198 |
199 size_t fPointBytes, fRectBytes, fTextBytes; | 199 size_t fPointBytes, fRectBytes, fTextBytes; |
200 int fPointWrites, fRectWrites, fTextWrites; | 200 int fPointWrites, fRectWrites, fTextWrites; |
201 #endif | 201 #endif |
202 | 202 |
203 #ifdef SK_DEBUG_VALIDATE | 203 #ifdef SK_DEBUG_VALIDATE |
204 public: | 204 public: |
205 void validate(uint32_t initialOffset, uint32_t size) const; | 205 void validate(size_t initialOffset, uint32_t size) const; |
206 private: | 206 private: |
207 void validateBitmaps() const; | 207 void validateBitmaps() const; |
208 void validateMatrices() const; | 208 void validateMatrices() const; |
209 void validatePaints() const; | 209 void validatePaints() const; |
210 void validatePaths() const; | 210 void validatePaths() const; |
211 void validateRegions() const; | 211 void validateRegions() const; |
212 #else | 212 #else |
213 public: | 213 public: |
214 void validate(uint32_t initialOffset, uint32_t size) const { | 214 void validate(size_t initialOffset, uint32_t size) const { |
215 SkASSERT(fWriter.size() == initialOffset + size); | 215 SkASSERT(fWriter.size() == initialOffset + size); |
216 } | 216 } |
217 #endif | 217 #endif |
218 | 218 |
219 protected: | 219 protected: |
220 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been | 220 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been |
221 // tweaked by paint.computeFastBounds(). | 221 // tweaked by paint.computeFastBounds(). |
222 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo
t[2]); | 222 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo
t[2]); |
223 | 223 |
224 // Make sure that flat has fTopBot written. | 224 // Make sure that flat has fTopBot written. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 uint32_t fRecordFlags; | 262 uint32_t fRecordFlags; |
263 int fInitialSaveCount; | 263 int fInitialSaveCount; |
264 | 264 |
265 friend class SkPicturePlayback; | 265 friend class SkPicturePlayback; |
266 friend class SkPictureTester; // for unit testing | 266 friend class SkPictureTester; // for unit testing |
267 | 267 |
268 typedef SkCanvas INHERITED; | 268 typedef SkCanvas INHERITED; |
269 }; | 269 }; |
270 | 270 |
271 #endif | 271 #endif |
OLD | NEW |