Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 void beginRecording(); | 109 void beginRecording(); |
| 110 void endRecording(); | 110 void endRecording(); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 void handleOptimization(int opt); | 113 void handleOptimization(int opt); |
| 114 int recordRestoreOffsetPlaceholder(SkRegion::Op); | 114 int recordRestoreOffsetPlaceholder(SkRegion::Op); |
| 115 void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffse t); | 115 void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffse t); |
| 116 | 116 |
| 117 #ifndef SK_COLLAPSE_MATRIX_CLIP_STATE | 117 #ifndef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 118 SkTDArray<int32_t> fRestoreOffsetStack; | 118 SkTDArray<int32_t> fRestoreOffsetStack; |
| 119 SkTDArray<uint32_t> fCullOffsetStack; | |
|
caryclark
2014/02/14 14:54:35
Since the restore offset stack is int and the cull
f(malita)
2014/02/20 02:37:26
Indeed: we store negative values in fRestoreOffset
| |
| 119 int fFirstSavedLayerIndex; | 120 int fFirstSavedLayerIndex; |
| 120 enum { | 121 enum { |
| 121 kNoSavedLayerIndex = -1 | 122 kNoSavedLayerIndex = -1 |
| 122 }; | 123 }; |
| 123 #endif | 124 #endif |
| 124 | 125 |
| 125 /* | 126 /* |
| 126 * Write the 'drawType' operation and chunk size to the skp. 'size' | 127 * Write the 'drawType' operation and chunk size to the skp. 'size' |
| 127 * can potentially be increased if the chunk size needs its own storage | 128 * can potentially be increased if the chunk size needs its own storage |
| 128 * location (i.e., it overflows 24 bits). | 129 * location (i.e., it overflows 24 bits). |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 void validateRegions() const; | 215 void validateRegions() const; |
| 215 #else | 216 #else |
| 216 public: | 217 public: |
| 217 void validate(size_t initialOffset, uint32_t size) const { | 218 void validate(size_t initialOffset, uint32_t size) const { |
| 218 SkASSERT(fWriter.bytesWritten() == initialOffset + size); | 219 SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
| 219 } | 220 } |
| 220 #endif | 221 #endif |
| 221 | 222 |
| 222 protected: | 223 protected: |
| 223 virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; | 224 virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; |
| 225 virtual void onPushCull(const SkRect&) SK_OVERRIDE; | |
| 226 virtual void onPopCull() SK_OVERRIDE; | |
| 224 | 227 |
| 225 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been | 228 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been |
| 226 // tweaked by paint.computeFastBounds(). | 229 // tweaked by paint.computeFastBounds(). |
| 227 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo t[2]); | 230 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo t[2]); |
| 228 | 231 |
| 229 // Make sure that flat has fTopBot written. | 232 // Make sure that flat has fTopBot written. |
| 230 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { | 233 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { |
| 231 if (!flat.isTopBotWritten()) { | 234 if (!flat.isTopBotWritten()) { |
| 232 ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); | 235 ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); |
| 233 SkASSERT(flat.isTopBotWritten()); | 236 SkASSERT(flat.isTopBotWritten()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 friend class SkPictureTester; // for unit testing | 289 friend class SkPictureTester; // for unit testing |
| 287 | 290 |
| 288 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 291 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 289 SkMatrixClipStateMgr fMCMgr; | 292 SkMatrixClipStateMgr fMCMgr; |
| 290 #endif | 293 #endif |
| 291 | 294 |
| 292 typedef SkCanvas INHERITED; | 295 typedef SkCanvas INHERITED; |
| 293 }; | 296 }; |
| 294 | 297 |
| 295 #endif | 298 #endif |
| OLD | NEW |