| 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 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
| 9 #include "SkTSearch.h" | 9 #include "SkTSearch.h" |
| 10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 kNoInitialSave = -1, | 21 kNoInitialSave = -1, |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et
c. | 24 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et
c. |
| 25 static int const kUInt32Size = 4; | 25 static int const kUInt32Size = 4; |
| 26 | 26 |
| 27 static const uint32_t kSaveSize = 2 * kUInt32Size; | 27 static const uint32_t kSaveSize = 2 * kUInt32Size; |
| 28 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size; | 28 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size; |
| 29 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect
); | 29 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect
); |
| 30 | 30 |
| 31 SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) : | 31 SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) : |
| 32 INHERITED(device), | 32 INHERITED(device), |
| 33 fBoundingHierarchy(NULL), | 33 fBoundingHierarchy(NULL), |
| 34 fStateTree(NULL), | 34 fStateTree(NULL), |
| 35 fFlattenableHeap(HEAP_BLOCK_SIZE), | 35 fFlattenableHeap(HEAP_BLOCK_SIZE), |
| 36 fMatrices(&fFlattenableHeap), | 36 fMatrices(&fFlattenableHeap), |
| 37 fPaints(&fFlattenableHeap), | 37 fPaints(&fFlattenableHeap), |
| 38 fRegions(&fFlattenableHeap), | 38 fRegions(&fFlattenableHeap), |
| 39 fWriter(MIN_WRITER_SIZE), | 39 fWriter(MIN_WRITER_SIZE), |
| 40 fRecordFlags(flags) { | 40 fRecordFlags(flags) { |
| 41 #ifdef SK_DEBUG_SIZE | 41 #ifdef SK_DEBUG_SIZE |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } else { | 131 } else { |
| 132 SkASSERT(kSaveLayerWithBoundsSize == opSize); | 132 SkASSERT(kSaveLayerWithBoundsSize == opSize); |
| 133 return kSaveLayerWithBoundsPaintOffset + overflow; | 133 return kSaveLayerWithBoundsPaintOffset + overflow; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth
od | 137 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth
od |
| 138 return gPaintOffsets[op] * sizeof(uint32_t) + overflow; | 138 return gPaintOffsets[op] * sizeof(uint32_t) + overflow; |
| 139 } | 139 } |
| 140 | 140 |
| 141 SkDevice* SkPictureRecord::setDevice(SkDevice* device) { | 141 SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { |
| 142 SkASSERT(!"eeek, don't try to change the device on a recording canvas"); | 142 SkASSERT(!"eeek, don't try to change the device on a recording canvas"); |
| 143 return this->INHERITED::setDevice(device); | 143 return this->INHERITED::setDevice(device); |
| 144 } | 144 } |
| 145 | 145 |
| 146 int SkPictureRecord::save(SaveFlags flags) { | 146 int SkPictureRecord::save(SaveFlags flags) { |
| 147 // record the offset to us, making it non-positive to distinguish a save | 147 // record the offset to us, making it non-positive to distinguish a save |
| 148 // from a clip entry. | 148 // from a clip entry. |
| 149 fRestoreOffsetStack.push(-(int32_t)fWriter.size()); | 149 fRestoreOffsetStack.push(-(int32_t)fWriter.size()); |
| 150 | 150 |
| 151 // op + flags | 151 // op + flags |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 void SkPictureRecord::validateRegions() const { | 1482 void SkPictureRecord::validateRegions() const { |
| 1483 int count = fRegions.count(); | 1483 int count = fRegions.count(); |
| 1484 SkASSERT((unsigned) count < 0x1000); | 1484 SkASSERT((unsigned) count < 0x1000); |
| 1485 for (int index = 0; index < count; index++) { | 1485 for (int index = 0; index < count; index++) { |
| 1486 const SkFlatData* region = fRegions[index]; | 1486 const SkFlatData* region = fRegions[index]; |
| 1487 SkASSERT(region); | 1487 SkASSERT(region); |
| 1488 // region->validate(); | 1488 // region->validate(); |
| 1489 } | 1489 } |
| 1490 } | 1490 } |
| 1491 #endif | 1491 #endif |
| OLD | NEW |