| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 size_t addDraw(DrawType drawType, uint32_t* size) { | 133 size_t addDraw(DrawType drawType, uint32_t* size) { |
| 134 size_t offset = fWriter.size(); | 134 size_t offset = fWriter.bytesWritten(); |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 void validate(size_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(size_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.bytesWritten() == 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. |
| 225 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { | 225 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { |
| (...skipping 36 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 |