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 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkTSearch.h" | 9 #include "SkTSearch.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 , fPaints(&fFlattenableHeap) | 36 , fPaints(&fFlattenableHeap) |
37 , fRecordFlags(flags) { | 37 , fRecordFlags(flags) { |
38 #ifdef SK_DEBUG_SIZE | 38 #ifdef SK_DEBUG_SIZE |
39 fPointBytes = fRectBytes = fTextBytes = 0; | 39 fPointBytes = fRectBytes = fTextBytes = 0; |
40 fPointWrites = fRectWrites = fTextWrites = 0; | 40 fPointWrites = fRectWrites = fTextWrites = 0; |
41 #endif | 41 #endif |
42 | 42 |
43 fBitmapHeap = SkNEW(SkBitmapHeap); | 43 fBitmapHeap = SkNEW(SkBitmapHeap); |
44 fFlattenableHeap.setBitmapStorage(fBitmapHeap); | 44 fFlattenableHeap.setBitmapStorage(fBitmapHeap); |
45 fPathHeap = NULL; // lazy allocate | 45 fPathHeap = NULL; // lazy allocate |
| 46 #ifndef SK_COLLAPSE_MATRIX_CLIP_STATE |
46 fFirstSavedLayerIndex = kNoSavedLayerIndex; | 47 fFirstSavedLayerIndex = kNoSavedLayerIndex; |
| 48 #endif |
47 | 49 |
48 fInitialSaveCount = kNoInitialSave; | 50 fInitialSaveCount = kNoInitialSave; |
| 51 |
| 52 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 53 fMCMgr.init(this); |
| 54 #endif |
49 } | 55 } |
50 | 56 |
51 SkPictureRecord::~SkPictureRecord() { | 57 SkPictureRecord::~SkPictureRecord() { |
52 SkSafeUnref(fBitmapHeap); | 58 SkSafeUnref(fBitmapHeap); |
53 SkSafeUnref(fPathHeap); | 59 SkSafeUnref(fPathHeap); |
54 SkSafeUnref(fBoundingHierarchy); | 60 SkSafeUnref(fBoundingHierarchy); |
55 SkSafeUnref(fStateTree); | 61 SkSafeUnref(fStateTree); |
56 fFlattenableHeap.setBitmapStorage(NULL); | 62 fFlattenableHeap.setBitmapStorage(NULL); |
57 fPictureRefs.unrefAll(); | 63 fPictureRefs.unrefAll(); |
58 } | 64 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth
od | 138 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth
od |
133 return gPaintOffsets[op] * sizeof(uint32_t) + overflow; | 139 return gPaintOffsets[op] * sizeof(uint32_t) + overflow; |
134 } | 140 } |
135 | 141 |
136 SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { | 142 SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { |
137 SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas"); | 143 SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas"); |
138 return this->INHERITED::setDevice(device); | 144 return this->INHERITED::setDevice(device); |
139 } | 145 } |
140 | 146 |
141 int SkPictureRecord::save(SaveFlags flags) { | 147 int SkPictureRecord::save(SaveFlags flags) { |
| 148 |
| 149 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 150 fMCMgr.save(flags); |
| 151 #else |
142 // record the offset to us, making it non-positive to distinguish a save | 152 // record the offset to us, making it non-positive to distinguish a save |
143 // from a clip entry. | 153 // from a clip entry. |
144 fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); | 154 fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); |
145 this->recordSave(flags); | 155 this->recordSave(flags); |
| 156 #endif |
146 return this->INHERITED::save(flags); | 157 return this->INHERITED::save(flags); |
147 } | 158 } |
148 | 159 |
149 void SkPictureRecord::recordSave(SaveFlags flags) { | 160 void SkPictureRecord::recordSave(SaveFlags flags) { |
150 // op + flags | 161 // op + flags |
151 uint32_t size = kSaveSize; | 162 uint32_t size = kSaveSize; |
152 size_t initialOffset = this->addDraw(SAVE, &size); | 163 size_t initialOffset = this->addDraw(SAVE, &size); |
153 this->addInt(flags); | 164 this->addInt(flags); |
154 | 165 |
155 this->validate(initialOffset, size); | 166 this->validate(initialOffset, size); |
156 } | 167 } |
157 | 168 |
158 int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, | 169 int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, |
159 SaveFlags flags) { | 170 SaveFlags flags) { |
| 171 |
| 172 int count; |
| 173 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 174 count = fMCMgr.saveLayer(bounds, paint, flags); |
| 175 #else |
160 // record the offset to us, making it non-positive to distinguish a save | 176 // record the offset to us, making it non-positive to distinguish a save |
161 // from a clip entry. | 177 // from a clip entry. |
162 fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); | 178 fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); |
163 this->recordSaveLayer(bounds, paint, flags); | 179 this->recordSaveLayer(bounds, paint, flags); |
164 if (kNoSavedLayerIndex == fFirstSavedLayerIndex) { | 180 if (kNoSavedLayerIndex == fFirstSavedLayerIndex) { |
165 fFirstSavedLayerIndex = fRestoreOffsetStack.count(); | 181 fFirstSavedLayerIndex = fRestoreOffsetStack.count(); |
166 } | 182 } |
| 183 #endif |
167 | 184 |
168 /* Don't actually call INHERITED::saveLayer, because that will try to alloc
ate | 185 /* Don't actually call INHERITED::saveLayer, because that will try to alloc
ate |
169 an offscreen device (potentially very big) which we don't actually need | 186 an offscreen device (potentially very big) which we don't actually need |
170 at this time (and may not be able to afford since during record our | 187 at this time (and may not be able to afford since during record our |
171 clip starts out the size of the picture, which is often much larger | 188 clip starts out the size of the picture, which is often much larger |
172 than the size of the actual device we'll use during playback). | 189 than the size of the actual device we'll use during playback). |
173 */ | 190 */ |
174 int count = this->INHERITED::save(flags); | 191 count = this->INHERITED::save(flags); |
175 this->clipRectBounds(bounds, flags, NULL); | 192 this->clipRectBounds(bounds, flags, NULL); |
176 return count; | 193 return count; |
177 } | 194 } |
178 | 195 |
179 void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint
, | 196 void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint
, |
180 SaveFlags flags) { | 197 SaveFlags flags) { |
181 // op + bool for 'bounds' | 198 // op + bool for 'bounds' |
182 uint32_t size = 2 * kUInt32Size; | 199 uint32_t size = 2 * kUInt32Size; |
183 if (NULL != bounds) { | 200 if (NULL != bounds) { |
184 size += sizeof(*bounds); // + rect | 201 size += sizeof(*bounds); // + rect |
185 } | 202 } |
186 // + paint index + flags | 203 // + paint index + flags |
187 size += 2 * kUInt32Size; | 204 size += 2 * kUInt32Size; |
188 | 205 |
189 SkASSERT(kSaveLayerNoBoundsSize == size || kSaveLayerWithBoundsSize == size)
; | 206 SkASSERT(kSaveLayerNoBoundsSize == size || kSaveLayerWithBoundsSize == size)
; |
190 | 207 |
191 size_t initialOffset = this->addDraw(SAVE_LAYER, &size); | 208 size_t initialOffset = this->addDraw(SAVE_LAYER, &size); |
192 this->addRectPtr(bounds); | 209 this->addRectPtr(bounds); |
193 SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.bytesWrit
ten()); | 210 SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.bytesWrit
ten()); |
194 this->addPaintPtr(paint); | 211 this->addPaintPtr(paint); |
195 this->addInt(flags); | 212 this->addInt(flags); |
196 | 213 |
197 this->validate(initialOffset, size); | 214 this->validate(initialOffset, size); |
198 } | 215 } |
199 | 216 |
200 bool SkPictureRecord::isDrawingToLayer() const { | 217 bool SkPictureRecord::isDrawingToLayer() const { |
| 218 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 219 return fMCMgr.isDrawingToLayer(); |
| 220 #else |
201 return fFirstSavedLayerIndex != kNoSavedLayerIndex; | 221 return fFirstSavedLayerIndex != kNoSavedLayerIndex; |
| 222 #endif |
202 } | 223 } |
203 | 224 |
204 /* | 225 /* |
205 * Read the op code from 'offset' in 'writer' and extract the size too. | 226 * Read the op code from 'offset' in 'writer' and extract the size too. |
206 */ | 227 */ |
207 static DrawType peek_op_and_size(SkWriter32* writer, int32_t offset, uint32_t* s
ize) { | 228 static DrawType peek_op_and_size(SkWriter32* writer, int32_t offset, uint32_t* s
ize) { |
208 uint32_t peek = writer->read32At(offset); | 229 uint32_t peek = writer->read32At(offset); |
209 | 230 |
210 uint32_t op; | 231 uint32_t op; |
211 UNPACK_8_24(peek, op, *size); | 232 UNPACK_8_24(peek, op, *size); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 591 } |
571 | 592 |
572 void SkPictureRecord::restore() { | 593 void SkPictureRecord::restore() { |
573 // FIXME: SkDeferredCanvas needs to be refactored to respect | 594 // FIXME: SkDeferredCanvas needs to be refactored to respect |
574 // save/restore balancing so that the following test can be | 595 // save/restore balancing so that the following test can be |
575 // turned on permanently. | 596 // turned on permanently. |
576 #if 0 | 597 #if 0 |
577 SkASSERT(fRestoreOffsetStack.count() > 1); | 598 SkASSERT(fRestoreOffsetStack.count() > 1); |
578 #endif | 599 #endif |
579 | 600 |
| 601 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 602 if (fMCMgr.getSaveCount() == 1) { |
| 603 return; |
| 604 } |
| 605 |
| 606 // TODO: don't write the restore to the op stream for normal saves |
| 607 fMCMgr.restore(); |
| 608 #else |
580 // check for underflow | 609 // check for underflow |
581 if (fRestoreOffsetStack.count() == 0) { | 610 if (fRestoreOffsetStack.count() == 0) { |
582 return; | 611 return; |
583 } | 612 } |
584 | 613 |
585 if (fRestoreOffsetStack.count() == fFirstSavedLayerIndex) { | 614 if (fRestoreOffsetStack.count() == fFirstSavedLayerIndex) { |
586 fFirstSavedLayerIndex = kNoSavedLayerIndex; | 615 fFirstSavedLayerIndex = kNoSavedLayerIndex; |
587 } | 616 } |
588 | 617 |
589 size_t opt = 0; | 618 size_t opt = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
602 } | 631 } |
603 } | 632 } |
604 | 633 |
605 if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) || | 634 if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) || |
606 SK_ARRAY_COUNT(gPictureRecordOpts) == opt) { | 635 SK_ARRAY_COUNT(gPictureRecordOpts) == opt) { |
607 // No optimization fired so add the RESTORE | 636 // No optimization fired so add the RESTORE |
608 this->recordRestore(); | 637 this->recordRestore(); |
609 } | 638 } |
610 | 639 |
611 fRestoreOffsetStack.pop(); | 640 fRestoreOffsetStack.pop(); |
| 641 #endif |
612 | 642 |
613 return this->INHERITED::restore(); | 643 return this->INHERITED::restore(); |
614 } | 644 } |
615 | 645 |
616 void SkPictureRecord::recordRestore() { | 646 void SkPictureRecord::recordRestore(bool fillInSkips) { |
617 uint32_t initialOffset, size; | 647 uint32_t initialOffset, size; |
618 this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.by
tesWritten()); | 648 if (fillInSkips) { |
| 649 this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWrite
r.bytesWritten()); |
| 650 } |
619 size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code | 651 size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code |
620 initialOffset = this->addDraw(RESTORE, &size); | 652 initialOffset = this->addDraw(RESTORE, &size); |
621 this->validate(initialOffset, size); | 653 this->validate(initialOffset, size); |
622 } | 654 } |
623 | 655 |
624 bool SkPictureRecord::translate(SkScalar dx, SkScalar dy) { | 656 bool SkPictureRecord::translate(SkScalar dx, SkScalar dy) { |
| 657 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 658 fMCMgr.translate(dx, dy); |
| 659 #else |
625 // op + dx + dy | 660 // op + dx + dy |
626 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); | 661 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); |
627 size_t initialOffset = this->addDraw(TRANSLATE, &size); | 662 size_t initialOffset = this->addDraw(TRANSLATE, &size); |
628 this->addScalar(dx); | 663 this->addScalar(dx); |
629 this->addScalar(dy); | 664 this->addScalar(dy); |
630 this->validate(initialOffset, size); | 665 this->validate(initialOffset, size); |
| 666 #endif |
631 return this->INHERITED::translate(dx, dy); | 667 return this->INHERITED::translate(dx, dy); |
632 } | 668 } |
633 | 669 |
634 bool SkPictureRecord::scale(SkScalar sx, SkScalar sy) { | 670 bool SkPictureRecord::scale(SkScalar sx, SkScalar sy) { |
| 671 |
| 672 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 673 fMCMgr.scale(sx, sy); |
| 674 #else |
635 // op + sx + sy | 675 // op + sx + sy |
636 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); | 676 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); |
637 size_t initialOffset = this->addDraw(SCALE, &size); | 677 size_t initialOffset = this->addDraw(SCALE, &size); |
638 this->addScalar(sx); | 678 this->addScalar(sx); |
639 this->addScalar(sy); | 679 this->addScalar(sy); |
640 this->validate(initialOffset, size); | 680 this->validate(initialOffset, size); |
| 681 #endif |
641 return this->INHERITED::scale(sx, sy); | 682 return this->INHERITED::scale(sx, sy); |
642 } | 683 } |
643 | 684 |
644 bool SkPictureRecord::rotate(SkScalar degrees) { | 685 bool SkPictureRecord::rotate(SkScalar degrees) { |
| 686 |
| 687 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 688 fMCMgr.rotate(degrees); |
| 689 #else |
645 // op + degrees | 690 // op + degrees |
646 uint32_t size = 1 * kUInt32Size + sizeof(SkScalar); | 691 uint32_t size = 1 * kUInt32Size + sizeof(SkScalar); |
647 size_t initialOffset = this->addDraw(ROTATE, &size); | 692 size_t initialOffset = this->addDraw(ROTATE, &size); |
648 this->addScalar(degrees); | 693 this->addScalar(degrees); |
649 this->validate(initialOffset, size); | 694 this->validate(initialOffset, size); |
| 695 #endif |
650 return this->INHERITED::rotate(degrees); | 696 return this->INHERITED::rotate(degrees); |
651 } | 697 } |
652 | 698 |
653 bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) { | 699 bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) { |
| 700 |
| 701 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 702 fMCMgr.skew(sx, sy); |
| 703 #else |
654 // op + sx + sy | 704 // op + sx + sy |
655 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); | 705 uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar); |
656 size_t initialOffset = this->addDraw(SKEW, &size); | 706 size_t initialOffset = this->addDraw(SKEW, &size); |
657 this->addScalar(sx); | 707 this->addScalar(sx); |
658 this->addScalar(sy); | 708 this->addScalar(sy); |
659 this->validate(initialOffset, size); | 709 this->validate(initialOffset, size); |
| 710 #endif |
660 return this->INHERITED::skew(sx, sy); | 711 return this->INHERITED::skew(sx, sy); |
661 } | 712 } |
662 | 713 |
663 bool SkPictureRecord::concat(const SkMatrix& matrix) { | 714 bool SkPictureRecord::concat(const SkMatrix& matrix) { |
| 715 |
| 716 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 717 fMCMgr.concat(matrix); |
| 718 #else |
664 this->recordConcat(matrix); | 719 this->recordConcat(matrix); |
| 720 #endif |
665 return this->INHERITED::concat(matrix); | 721 return this->INHERITED::concat(matrix); |
666 } | 722 } |
667 | 723 |
668 void SkPictureRecord::recordConcat(const SkMatrix& matrix) { | 724 void SkPictureRecord::recordConcat(const SkMatrix& matrix) { |
669 this->validate(fWriter.bytesWritten(), 0); | 725 this->validate(fWriter.bytesWritten(), 0); |
670 // op + matrix | 726 // op + matrix |
671 uint32_t size = kUInt32Size + matrix.writeToMemory(NULL); | 727 uint32_t size = kUInt32Size + matrix.writeToMemory(NULL); |
672 size_t initialOffset = this->addDraw(CONCAT, &size); | 728 size_t initialOffset = this->addDraw(CONCAT, &size); |
673 this->addMatrix(matrix); | 729 this->addMatrix(matrix); |
674 this->validate(initialOffset, size); | 730 this->validate(initialOffset, size); |
675 } | 731 } |
676 | 732 |
677 void SkPictureRecord::setMatrix(const SkMatrix& matrix) { | 733 void SkPictureRecord::setMatrix(const SkMatrix& matrix) { |
| 734 |
| 735 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 736 fMCMgr.setMatrix(matrix); |
| 737 #else |
678 this->validate(fWriter.bytesWritten(), 0); | 738 this->validate(fWriter.bytesWritten(), 0); |
679 // op + matrix | 739 // op + matrix |
680 uint32_t size = kUInt32Size + matrix.writeToMemory(NULL); | 740 uint32_t size = kUInt32Size + matrix.writeToMemory(NULL); |
681 size_t initialOffset = this->addDraw(SET_MATRIX, &size); | 741 size_t initialOffset = this->addDraw(SET_MATRIX, &size); |
682 this->addMatrix(matrix); | 742 this->addMatrix(matrix); |
683 this->validate(initialOffset, size); | 743 this->validate(initialOffset, size); |
| 744 #endif |
684 this->INHERITED::setMatrix(matrix); | 745 this->INHERITED::setMatrix(matrix); |
685 } | 746 } |
686 | 747 |
687 static bool regionOpExpands(SkRegion::Op op) { | 748 static bool regionOpExpands(SkRegion::Op op) { |
688 switch (op) { | 749 switch (op) { |
689 case SkRegion::kUnion_Op: | 750 case SkRegion::kUnion_Op: |
690 case SkRegion::kXOR_Op: | 751 case SkRegion::kXOR_Op: |
691 case SkRegion::kReverseDifference_Op: | 752 case SkRegion::kReverseDifference_Op: |
692 case SkRegion::kReplace_Op: | 753 case SkRegion::kReplace_Op: |
693 return true; | 754 return true; |
694 case SkRegion::kIntersect_Op: | 755 case SkRegion::kIntersect_Op: |
695 case SkRegion::kDifference_Op: | 756 case SkRegion::kDifference_Op: |
696 return false; | 757 return false; |
697 default: | 758 default: |
698 SkDEBUGFAIL("unknown region op"); | 759 SkDEBUGFAIL("unknown region op"); |
699 return false; | 760 return false; |
700 } | 761 } |
701 } | 762 } |
702 | 763 |
| 764 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 765 void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t
restoreOffset) { |
| 766 fMCMgr.fillInSkips(&fWriter, restoreOffset); |
| 767 } |
| 768 #else |
703 void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t
restoreOffset) { | 769 void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t
restoreOffset) { |
704 int32_t offset = fRestoreOffsetStack.top(); | 770 int32_t offset = fRestoreOffsetStack.top(); |
705 while (offset > 0) { | 771 while (offset > 0) { |
706 uint32_t peek = fWriter.read32At(offset); | 772 uint32_t peek = fWriter.read32At(offset); |
707 fWriter.write32At(offset, restoreOffset); | 773 fWriter.write32At(offset, restoreOffset); |
708 offset = peek; | 774 offset = peek; |
709 } | 775 } |
710 | 776 |
711 #ifdef SK_DEBUG | 777 #ifdef SK_DEBUG |
712 // assert that the final offset value points to a save verb | 778 // assert that the final offset value points to a save verb |
713 uint32_t opSize; | 779 uint32_t opSize; |
714 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize); | 780 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize); |
715 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp); | 781 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp); |
716 #endif | 782 #endif |
717 } | 783 } |
| 784 #endif |
718 | 785 |
719 void SkPictureRecord::beginRecording() { | 786 void SkPictureRecord::beginRecording() { |
720 // we have to call this *after* our constructor, to ensure that it gets | 787 // we have to call this *after* our constructor, to ensure that it gets |
721 // recorded. This is balanced by restoreToCount() call from endRecording, | 788 // recorded. This is balanced by restoreToCount() call from endRecording, |
722 // which in-turn calls our overridden restore(), so those get recorded too. | 789 // which in-turn calls our overridden restore(), so those get recorded too. |
723 fInitialSaveCount = this->save(kMatrixClip_SaveFlag); | 790 fInitialSaveCount = this->save(kMatrixClip_SaveFlag); |
724 } | 791 } |
725 | 792 |
726 void SkPictureRecord::endRecording() { | 793 void SkPictureRecord::endRecording() { |
727 SkASSERT(kNoInitialSave != fInitialSaveCount); | 794 SkASSERT(kNoInitialSave != fInitialSaveCount); |
728 this->restoreToCount(fInitialSaveCount); | 795 this->restoreToCount(fInitialSaveCount); |
| 796 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 797 fMCMgr.finish(); |
| 798 #endif |
729 } | 799 } |
730 | 800 |
| 801 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 802 int SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { |
| 803 size_t offset = fWriter.bytesWritten(); |
| 804 this->addInt(-1); |
| 805 return offset; |
| 806 } |
| 807 #else |
731 int SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { | 808 int SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { |
732 if (fRestoreOffsetStack.isEmpty()) { | 809 if (fRestoreOffsetStack.isEmpty()) { |
733 return -1; | 810 return -1; |
734 } | 811 } |
735 | 812 |
736 // The RestoreOffset field is initially filled with a placeholder | 813 // The RestoreOffset field is initially filled with a placeholder |
737 // value that points to the offset of the previous RestoreOffset | 814 // value that points to the offset of the previous RestoreOffset |
738 // in the current stack level, thus forming a linked list so that | 815 // in the current stack level, thus forming a linked list so that |
739 // the restore offsets can be filled in when the corresponding | 816 // the restore offsets can be filled in when the corresponding |
740 // restore command is recorded. | 817 // restore command is recorded. |
741 int32_t prevOffset = fRestoreOffsetStack.top(); | 818 int32_t prevOffset = fRestoreOffsetStack.top(); |
742 | 819 |
743 if (regionOpExpands(op)) { | 820 if (regionOpExpands(op)) { |
744 // Run back through any previous clip ops, and mark their offset to | 821 // Run back through any previous clip ops, and mark their offset to |
745 // be 0, disabling their ability to trigger a jump-to-restore, otherwise | 822 // be 0, disabling their ability to trigger a jump-to-restore, otherwise |
746 // they could hide this clips ability to expand the clip (i.e. go from | 823 // they could hide this clips ability to expand the clip (i.e. go from |
747 // empty to non-empty). | 824 // empty to non-empty). |
748 this->fillRestoreOffsetPlaceholdersForCurrentStackLevel(0); | 825 this->fillRestoreOffsetPlaceholdersForCurrentStackLevel(0); |
749 | 826 |
750 // Reset the pointer back to the previous clip so that subsequent | 827 // Reset the pointer back to the previous clip so that subsequent |
751 // restores don't overwrite the offsets we just cleared. | 828 // restores don't overwrite the offsets we just cleared. |
752 prevOffset = 0; | 829 prevOffset = 0; |
753 } | 830 } |
754 | 831 |
755 size_t offset = fWriter.bytesWritten(); | 832 size_t offset = fWriter.bytesWritten(); |
756 this->addInt(prevOffset); | 833 this->addInt(prevOffset); |
757 fRestoreOffsetStack.top() = offset; | 834 fRestoreOffsetStack.top() = offset; |
758 return offset; | 835 return offset; |
759 } | 836 } |
| 837 #endif |
760 | 838 |
761 bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { | 839 bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
| 840 |
| 841 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 842 fMCMgr.clipRect(rect, op, doAA); |
| 843 #else |
762 this->recordClipRect(rect, op, doAA); | 844 this->recordClipRect(rect, op, doAA); |
| 845 #endif |
763 return this->INHERITED::clipRect(rect, op, doAA); | 846 return this->INHERITED::clipRect(rect, op, doAA); |
764 } | 847 } |
765 | 848 |
766 int SkPictureRecord::recordClipRect(const SkRect& rect, SkRegion::Op op, bool do
AA) { | 849 int SkPictureRecord::recordClipRect(const SkRect& rect, SkRegion::Op op, bool do
AA) { |
767 | |
768 // id + rect + clip params | 850 // id + rect + clip params |
769 uint32_t size = 1 * kUInt32Size + sizeof(rect) + 1 * kUInt32Size; | 851 uint32_t size = 1 * kUInt32Size + sizeof(rect) + 1 * kUInt32Size; |
| 852 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 853 size += kUInt32Size; // + restore offset |
| 854 #else |
770 // recordRestoreOffsetPlaceholder doesn't always write an offset | 855 // recordRestoreOffsetPlaceholder doesn't always write an offset |
771 if (!fRestoreOffsetStack.isEmpty()) { | 856 if (!fRestoreOffsetStack.isEmpty()) { |
772 // + restore offset | 857 // + restore offset |
773 size += kUInt32Size; | 858 size += kUInt32Size; |
774 } | 859 } |
775 | 860 #endif |
776 size_t initialOffset = this->addDraw(CLIP_RECT, &size); | 861 size_t initialOffset = this->addDraw(CLIP_RECT, &size); |
777 this->addRect(rect); | 862 this->addRect(rect); |
778 this->addInt(ClipParams_pack(op, doAA)); | 863 this->addInt(ClipParams_pack(op, doAA)); |
779 int offset = this->recordRestoreOffsetPlaceholder(op); | 864 int offset = this->recordRestoreOffsetPlaceholder(op); |
780 | 865 |
781 this->validate(initialOffset, size); | 866 this->validate(initialOffset, size); |
782 return offset; | 867 return offset; |
783 } | 868 } |
784 | 869 |
785 bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA
) { | 870 bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA
) { |
786 if (rrect.isRect()) { | 871 if (rrect.isRect()) { |
787 return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA); | 872 return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA); |
788 } | 873 } |
789 | 874 |
| 875 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 876 fMCMgr.clipRRect(rrect, op, doAA); |
| 877 #else |
790 this->recordClipRRect(rrect, op, doAA); | 878 this->recordClipRRect(rrect, op, doAA); |
| 879 #endif |
791 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { | 880 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { |
792 return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op,
false); | 881 return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op,
false); |
793 } else { | 882 } else { |
794 return this->INHERITED::clipRRect(rrect, op, doAA); | 883 return this->INHERITED::clipRRect(rrect, op, doAA); |
795 } | 884 } |
796 } | 885 } |
797 | 886 |
798 int SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool
doAA) { | 887 int SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool
doAA) { |
799 | |
800 // op + rrect + clip params | 888 // op + rrect + clip params |
801 uint32_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; | 889 uint32_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; |
| 890 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 891 size += kUInt32Size; // + restore offset |
| 892 #else |
802 // recordRestoreOffsetPlaceholder doesn't always write an offset | 893 // recordRestoreOffsetPlaceholder doesn't always write an offset |
803 if (!fRestoreOffsetStack.isEmpty()) { | 894 if (!fRestoreOffsetStack.isEmpty()) { |
804 // + restore offset | 895 // + restore offset |
805 size += kUInt32Size; | 896 size += kUInt32Size; |
806 } | 897 } |
| 898 #endif |
807 size_t initialOffset = this->addDraw(CLIP_RRECT, &size); | 899 size_t initialOffset = this->addDraw(CLIP_RRECT, &size); |
808 this->addRRect(rrect); | 900 this->addRRect(rrect); |
809 this->addInt(ClipParams_pack(op, doAA)); | 901 this->addInt(ClipParams_pack(op, doAA)); |
810 int offset = recordRestoreOffsetPlaceholder(op); | 902 int offset = recordRestoreOffsetPlaceholder(op); |
811 | |
812 this->validate(initialOffset, size); | 903 this->validate(initialOffset, size); |
813 return offset; | 904 return offset; |
814 } | 905 } |
815 | 906 |
816 bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { | 907 bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
817 | 908 |
818 SkRect r; | 909 SkRect r; |
819 if (!path.isInverseFillType() && path.isRect(&r)) { | 910 if (!path.isInverseFillType() && path.isRect(&r)) { |
820 return this->clipRect(r, op, doAA); | 911 return this->clipRect(r, op, doAA); |
821 } | 912 } |
822 | 913 |
| 914 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 915 fMCMgr.clipPath(path, op, doAA); |
| 916 #else |
823 int pathID = this->addPathToHeap(path); | 917 int pathID = this->addPathToHeap(path); |
824 this->recordClipPath(pathID, op, doAA); | 918 this->recordClipPath(pathID, op, doAA); |
| 919 #endif |
825 | 920 |
826 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { | 921 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { |
827 return this->updateClipConservativelyUsingBounds(path.getBounds(), op, | 922 return this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
828 path.isInverseFillType(
)); | 923 path.isInverseFillType(
)); |
829 } else { | 924 } else { |
830 return this->INHERITED::clipPath(path, op, doAA); | 925 return this->INHERITED::clipPath(path, op, doAA); |
831 } | 926 } |
832 } | 927 } |
833 | 928 |
834 int SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { | 929 int SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { |
835 | |
836 // op + path index + clip params | 930 // op + path index + clip params |
837 uint32_t size = 3 * kUInt32Size; | 931 uint32_t size = 3 * kUInt32Size; |
| 932 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 933 size += kUInt32Size; // + restore offset |
| 934 #else |
838 // recordRestoreOffsetPlaceholder doesn't always write an offset | 935 // recordRestoreOffsetPlaceholder doesn't always write an offset |
839 if (!fRestoreOffsetStack.isEmpty()) { | 936 if (!fRestoreOffsetStack.isEmpty()) { |
840 // + restore offset | 937 // + restore offset |
841 size += kUInt32Size; | 938 size += kUInt32Size; |
842 } | 939 } |
| 940 #endif |
843 size_t initialOffset = this->addDraw(CLIP_PATH, &size); | 941 size_t initialOffset = this->addDraw(CLIP_PATH, &size); |
844 this->addInt(pathID); | 942 this->addInt(pathID); |
845 this->addInt(ClipParams_pack(op, doAA)); | 943 this->addInt(ClipParams_pack(op, doAA)); |
846 int offset = recordRestoreOffsetPlaceholder(op); | 944 int offset = recordRestoreOffsetPlaceholder(op); |
847 | |
848 this->validate(initialOffset, size); | 945 this->validate(initialOffset, size); |
849 return offset; | 946 return offset; |
850 } | 947 } |
851 | 948 |
852 bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) { | 949 bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) { |
| 950 |
| 951 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 952 fMCMgr.clipRegion(region, op); |
| 953 #else |
853 this->recordClipRegion(region, op); | 954 this->recordClipRegion(region, op); |
| 955 #endif |
854 return this->INHERITED::clipRegion(region, op); | 956 return this->INHERITED::clipRegion(region, op); |
855 } | 957 } |
856 | 958 |
857 int SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) { | 959 int SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) { |
858 // op + clip params + region | 960 // op + clip params + region |
859 uint32_t size = 2 * kUInt32Size + region.writeToMemory(NULL); | 961 uint32_t size = 2 * kUInt32Size + region.writeToMemory(NULL); |
| 962 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 963 size += kUInt32Size; // + restore offset |
| 964 #else |
860 // recordRestoreOffsetPlaceholder doesn't always write an offset | 965 // recordRestoreOffsetPlaceholder doesn't always write an offset |
861 if (!fRestoreOffsetStack.isEmpty()) { | 966 if (!fRestoreOffsetStack.isEmpty()) { |
862 // + restore offset | 967 // + restore offset |
863 size += kUInt32Size; | 968 size += kUInt32Size; |
864 } | 969 } |
| 970 #endif |
865 size_t initialOffset = this->addDraw(CLIP_REGION, &size); | 971 size_t initialOffset = this->addDraw(CLIP_REGION, &size); |
866 this->addRegion(region); | 972 this->addRegion(region); |
867 this->addInt(ClipParams_pack(op, false)); | 973 this->addInt(ClipParams_pack(op, false)); |
868 int offset = this->recordRestoreOffsetPlaceholder(op); | 974 int offset = this->recordRestoreOffsetPlaceholder(op); |
869 | 975 |
870 this->validate(initialOffset, size); | 976 this->validate(initialOffset, size); |
871 return offset; | 977 return offset; |
872 } | 978 } |
873 | 979 |
874 void SkPictureRecord::clear(SkColor color) { | 980 void SkPictureRecord::clear(SkColor color) { |
| 981 |
| 982 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 983 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 984 #endif |
| 985 |
875 // op + color | 986 // op + color |
876 uint32_t size = 2 * kUInt32Size; | 987 uint32_t size = 2 * kUInt32Size; |
877 size_t initialOffset = this->addDraw(DRAW_CLEAR, &size); | 988 size_t initialOffset = this->addDraw(DRAW_CLEAR, &size); |
878 this->addInt(color); | 989 this->addInt(color); |
879 this->validate(initialOffset, size); | 990 this->validate(initialOffset, size); |
880 } | 991 } |
881 | 992 |
882 void SkPictureRecord::drawPaint(const SkPaint& paint) { | 993 void SkPictureRecord::drawPaint(const SkPaint& paint) { |
| 994 |
| 995 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 996 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 997 #endif |
| 998 |
883 // op + paint index | 999 // op + paint index |
884 uint32_t size = 2 * kUInt32Size; | 1000 uint32_t size = 2 * kUInt32Size; |
885 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); | 1001 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); |
886 SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.bytesWrit
ten()); | 1002 SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.bytesWrit
ten()); |
887 this->addPaint(paint); | 1003 this->addPaint(paint); |
888 this->validate(initialOffset, size); | 1004 this->validate(initialOffset, size); |
889 } | 1005 } |
890 | 1006 |
891 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], | 1007 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], |
892 const SkPaint& paint) { | 1008 const SkPaint& paint) { |
| 1009 |
| 1010 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1011 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1012 #endif |
| 1013 |
893 // op + paint index + mode + count + point data | 1014 // op + paint index + mode + count + point data |
894 uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint); | 1015 uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint); |
895 size_t initialOffset = this->addDraw(DRAW_POINTS, &size); | 1016 size_t initialOffset = this->addDraw(DRAW_POINTS, &size); |
896 SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.bytesWri
tten()); | 1017 SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.bytesWri
tten()); |
897 this->addPaint(paint); | 1018 this->addPaint(paint); |
898 this->addInt(mode); | 1019 this->addInt(mode); |
899 this->addInt(count); | 1020 this->addInt(count); |
900 fWriter.writeMul4(pts, count * sizeof(SkPoint)); | 1021 fWriter.writeMul4(pts, count * sizeof(SkPoint)); |
901 this->validate(initialOffset, size); | 1022 this->validate(initialOffset, size); |
902 } | 1023 } |
903 | 1024 |
904 void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) { | 1025 void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) { |
| 1026 |
| 1027 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1028 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1029 #endif |
| 1030 |
905 // op + paint index + rect | 1031 // op + paint index + rect |
906 uint32_t size = 2 * kUInt32Size + sizeof(oval); | 1032 uint32_t size = 2 * kUInt32Size + sizeof(oval); |
907 size_t initialOffset = this->addDraw(DRAW_OVAL, &size); | 1033 size_t initialOffset = this->addDraw(DRAW_OVAL, &size); |
908 SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.bytesWritt
en()); | 1034 SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.bytesWritt
en()); |
909 this->addPaint(paint); | 1035 this->addPaint(paint); |
910 this->addRect(oval); | 1036 this->addRect(oval); |
911 this->validate(initialOffset, size); | 1037 this->validate(initialOffset, size); |
912 } | 1038 } |
913 | 1039 |
914 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { | 1040 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { |
| 1041 |
| 1042 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1043 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1044 #endif |
| 1045 |
915 // op + paint index + rect | 1046 // op + paint index + rect |
916 uint32_t size = 2 * kUInt32Size + sizeof(rect); | 1047 uint32_t size = 2 * kUInt32Size + sizeof(rect); |
917 size_t initialOffset = this->addDraw(DRAW_RECT, &size); | 1048 size_t initialOffset = this->addDraw(DRAW_RECT, &size); |
918 SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.bytesWritt
en()); | 1049 SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.bytesWritt
en()); |
919 this->addPaint(paint); | 1050 this->addPaint(paint); |
920 this->addRect(rect); | 1051 this->addRect(rect); |
921 this->validate(initialOffset, size); | 1052 this->validate(initialOffset, size); |
922 } | 1053 } |
923 | 1054 |
924 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 1055 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
| 1056 |
| 1057 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1058 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1059 #endif |
| 1060 |
925 if (rrect.isRect()) { | 1061 if (rrect.isRect()) { |
926 this->SkPictureRecord::drawRect(rrect.getBounds(), paint); | 1062 this->SkPictureRecord::drawRect(rrect.getBounds(), paint); |
927 } else if (rrect.isOval()) { | 1063 } else if (rrect.isOval()) { |
928 this->SkPictureRecord::drawOval(rrect.getBounds(), paint); | 1064 this->SkPictureRecord::drawOval(rrect.getBounds(), paint); |
929 } else { | 1065 } else { |
930 // op + paint index + rrect | 1066 // op + paint index + rrect |
931 uint32_t initialOffset, size; | 1067 uint32_t initialOffset, size; |
932 size = 2 * kUInt32Size + SkRRect::kSizeInMemory; | 1068 size = 2 * kUInt32Size + SkRRect::kSizeInMemory; |
933 initialOffset = this->addDraw(DRAW_RRECT, &size); | 1069 initialOffset = this->addDraw(DRAW_RRECT, &size); |
934 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytes
Written()); | 1070 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytes
Written()); |
935 this->addPaint(paint); | 1071 this->addPaint(paint); |
936 this->addRRect(rrect); | 1072 this->addRRect(rrect); |
937 this->validate(initialOffset, size); | 1073 this->validate(initialOffset, size); |
938 } | 1074 } |
939 } | 1075 } |
940 | 1076 |
941 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { | 1077 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { |
| 1078 |
| 1079 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1080 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1081 #endif |
| 1082 |
942 // op + paint index + path index | 1083 // op + paint index + path index |
943 uint32_t size = 3 * kUInt32Size; | 1084 uint32_t size = 3 * kUInt32Size; |
944 size_t initialOffset = this->addDraw(DRAW_PATH, &size); | 1085 size_t initialOffset = this->addDraw(DRAW_PATH, &size); |
945 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt
en()); | 1086 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt
en()); |
946 this->addPaint(paint); | 1087 this->addPaint(paint); |
947 this->addPath(path); | 1088 this->addPath(path); |
948 this->validate(initialOffset, size); | 1089 this->validate(initialOffset, size); |
949 } | 1090 } |
950 | 1091 |
951 void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
top, | 1092 void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
top, |
952 const SkPaint* paint = NULL) { | 1093 const SkPaint* paint = NULL) { |
953 if (bitmap.drawsNothing()) { | 1094 if (bitmap.drawsNothing()) { |
954 return; | 1095 return; |
955 } | 1096 } |
| 1097 |
| 1098 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1099 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1100 #endif |
| 1101 |
956 // op + paint index + bitmap index + left + top | 1102 // op + paint index + bitmap index + left + top |
957 uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); | 1103 uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); |
958 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); | 1104 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); |
959 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWri
tten()); | 1105 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWri
tten()); |
960 this->addPaintPtr(paint); | 1106 this->addPaintPtr(paint); |
961 this->addBitmap(bitmap); | 1107 this->addBitmap(bitmap); |
962 this->addScalar(left); | 1108 this->addScalar(left); |
963 this->addScalar(top); | 1109 this->addScalar(top); |
964 this->validate(initialOffset, size); | 1110 this->validate(initialOffset, size); |
965 } | 1111 } |
966 | 1112 |
967 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, | 1113 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, |
968 const SkRect& dst, const SkPaint* pai
nt, | 1114 const SkRect& dst, const SkPaint* pai
nt, |
969 DrawBitmapRectFlags flags) { | 1115 DrawBitmapRectFlags flags) { |
970 if (bitmap.drawsNothing()) { | 1116 if (bitmap.drawsNothing()) { |
971 return; | 1117 return; |
972 } | 1118 } |
| 1119 |
| 1120 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1121 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1122 #endif |
973 // id + paint index + bitmap index + bool for 'src' + flags | 1123 // id + paint index + bitmap index + bool for 'src' + flags |
974 uint32_t size = 5 * kUInt32Size; | 1124 uint32_t size = 5 * kUInt32Size; |
975 if (NULL != src) { | 1125 if (NULL != src) { |
976 size += sizeof(*src); // + rect | 1126 size += sizeof(*src); // + rect |
977 } | 1127 } |
978 size += sizeof(dst); // + rect | 1128 size += sizeof(dst); // + rect |
979 | 1129 |
980 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); | 1130 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); |
981 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) | 1131 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) |
982 == fWriter.bytesWritten()); | 1132 == fWriter.bytesWritten()); |
983 this->addPaintPtr(paint); | 1133 this->addPaintPtr(paint); |
984 this->addBitmap(bitmap); | 1134 this->addBitmap(bitmap); |
985 this->addRectPtr(src); // may be null | 1135 this->addRectPtr(src); // may be null |
986 this->addRect(dst); | 1136 this->addRect(dst); |
987 this->addInt(flags); | 1137 this->addInt(flags); |
988 this->validate(initialOffset, size); | 1138 this->validate(initialOffset, size); |
989 } | 1139 } |
990 | 1140 |
991 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, | 1141 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, |
992 const SkPaint* paint) { | 1142 const SkPaint* paint) { |
993 if (bitmap.drawsNothing()) { | 1143 if (bitmap.drawsNothing()) { |
994 return; | 1144 return; |
995 } | 1145 } |
| 1146 |
| 1147 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1148 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1149 #endif |
| 1150 |
996 // id + paint index + bitmap index + matrix | 1151 // id + paint index + bitmap index + matrix |
997 uint32_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL); | 1152 uint32_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL); |
998 size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); | 1153 size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); |
999 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.b
ytesWritten()); | 1154 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.b
ytesWritten()); |
1000 this->addPaintPtr(paint); | 1155 this->addPaintPtr(paint); |
1001 this->addBitmap(bitmap); | 1156 this->addBitmap(bitmap); |
1002 this->addMatrix(matrix); | 1157 this->addMatrix(matrix); |
1003 this->validate(initialOffset, size); | 1158 this->validate(initialOffset, size); |
1004 } | 1159 } |
1005 | 1160 |
1006 void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent
er, | 1161 void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent
er, |
1007 const SkRect& dst, const SkPaint* paint) { | 1162 const SkRect& dst, const SkPaint* paint) { |
1008 if (bitmap.drawsNothing()) { | 1163 if (bitmap.drawsNothing()) { |
1009 return; | 1164 return; |
1010 } | 1165 } |
| 1166 |
| 1167 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1168 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1169 #endif |
| 1170 |
1011 // op + paint index + bitmap id + center + dst rect | 1171 // op + paint index + bitmap id + center + dst rect |
1012 uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); | 1172 uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); |
1013 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); | 1173 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); |
1014 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.byt
esWritten()); | 1174 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.byt
esWritten()); |
1015 this->addPaintPtr(paint); | 1175 this->addPaintPtr(paint); |
1016 this->addBitmap(bitmap); | 1176 this->addBitmap(bitmap); |
1017 this->addIRect(center); | 1177 this->addIRect(center); |
1018 this->addRect(dst); | 1178 this->addRect(dst); |
1019 this->validate(initialOffset, size); | 1179 this->validate(initialOffset, size); |
1020 } | 1180 } |
1021 | 1181 |
1022 void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top, | 1182 void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top, |
1023 const SkPaint* paint = NULL) { | 1183 const SkPaint* paint = NULL) { |
1024 if (bitmap.drawsNothing()) { | 1184 if (bitmap.drawsNothing()) { |
1025 return; | 1185 return; |
1026 } | 1186 } |
| 1187 |
| 1188 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1189 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1190 #endif |
| 1191 |
1027 // op + paint index + bitmap index + left + top | 1192 // op + paint index + bitmap index + left + top |
1028 uint32_t size = 5 * kUInt32Size; | 1193 uint32_t size = 5 * kUInt32Size; |
1029 size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); | 1194 size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); |
1030 SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.bytesWri
tten()); | 1195 SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.bytesWri
tten()); |
1031 this->addPaintPtr(paint); | 1196 this->addPaintPtr(paint); |
1032 this->addBitmap(bitmap); | 1197 this->addBitmap(bitmap); |
1033 this->addInt(left); | 1198 this->addInt(left); |
1034 this->addInt(top); | 1199 this->addInt(top); |
1035 this->validate(initialOffset, size); | 1200 this->validate(initialOffset, size); |
1036 } | 1201 } |
(...skipping 12 matching lines...) Expand all Loading... |
1049 | 1214 |
1050 void SkPictureRecord::addFontMetricsTopBottom(const SkPaint& paint, const SkFlat
Data& flat, | 1215 void SkPictureRecord::addFontMetricsTopBottom(const SkPaint& paint, const SkFlat
Data& flat, |
1051 SkScalar minY, SkScalar maxY) { | 1216 SkScalar minY, SkScalar maxY) { |
1052 WriteTopBot(paint, flat); | 1217 WriteTopBot(paint, flat); |
1053 this->addScalar(flat.topBot()[0] + minY); | 1218 this->addScalar(flat.topBot()[0] + minY); |
1054 this->addScalar(flat.topBot()[1] + maxY); | 1219 this->addScalar(flat.topBot()[1] + maxY); |
1055 } | 1220 } |
1056 | 1221 |
1057 void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x, | 1222 void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x, |
1058 SkScalar y, const SkPaint& paint) { | 1223 SkScalar y, const SkPaint& paint) { |
| 1224 |
| 1225 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1226 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1227 #endif |
| 1228 |
1059 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds(); | 1229 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds(); |
1060 | 1230 |
1061 // op + paint index + length + 'length' worth of chars + x + y | 1231 // op + paint index + length + 'length' worth of chars + x + y |
1062 uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar
); | 1232 uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar
); |
1063 if (fast) { | 1233 if (fast) { |
1064 size += 2 * sizeof(SkScalar); // + top & bottom | 1234 size += 2 * sizeof(SkScalar); // + top & bottom |
1065 } | 1235 } |
1066 | 1236 |
1067 DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT; | 1237 DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT; |
1068 size_t initialOffset = this->addDraw(op, &size); | 1238 size_t initialOffset = this->addDraw(op, &size); |
1069 SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten()); | 1239 SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten()); |
1070 const SkFlatData* flatPaintData = addPaint(paint); | 1240 const SkFlatData* flatPaintData = addPaint(paint); |
1071 SkASSERT(flatPaintData); | 1241 SkASSERT(flatPaintData); |
1072 this->addText(text, byteLength); | 1242 this->addText(text, byteLength); |
1073 this->addScalar(x); | 1243 this->addScalar(x); |
1074 this->addScalar(y); | 1244 this->addScalar(y); |
1075 if (fast) { | 1245 if (fast) { |
1076 this->addFontMetricsTopBottom(paint, *flatPaintData, y, y); | 1246 this->addFontMetricsTopBottom(paint, *flatPaintData, y, y); |
1077 } | 1247 } |
1078 this->validate(initialOffset, size); | 1248 this->validate(initialOffset, size); |
1079 } | 1249 } |
1080 | 1250 |
1081 void SkPictureRecord::drawPosText(const void* text, size_t byteLength, | 1251 void SkPictureRecord::drawPosText(const void* text, size_t byteLength, |
1082 const SkPoint pos[], const SkPaint& paint) { | 1252 const SkPoint pos[], const SkPaint& paint) { |
| 1253 |
| 1254 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1255 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1256 #endif |
| 1257 |
1083 size_t points = paint.countText(text, byteLength); | 1258 size_t points = paint.countText(text, byteLength); |
1084 if (0 == points) | 1259 if (0 == points) |
1085 return; | 1260 return; |
1086 | 1261 |
1087 bool canUseDrawH = true; | 1262 bool canUseDrawH = true; |
1088 SkScalar minY = pos[0].fY; | 1263 SkScalar minY = pos[0].fY; |
1089 SkScalar maxY = pos[0].fY; | 1264 SkScalar maxY = pos[0].fY; |
1090 // check if the caller really should have used drawPosTextH() | 1265 // check if the caller really should have used drawPosTextH() |
1091 { | 1266 { |
1092 const SkScalar firstY = pos[0].fY; | 1267 const SkScalar firstY = pos[0].fY; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 fPointBytes += fWriter.bytesWritten() - start; | 1334 fPointBytes += fWriter.bytesWritten() - start; |
1160 fPointWrites += points; | 1335 fPointWrites += points; |
1161 #endif | 1336 #endif |
1162 this->validate(initialOffset, size); | 1337 this->validate(initialOffset, size); |
1163 } | 1338 } |
1164 | 1339 |
1165 void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength, | 1340 void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength, |
1166 const SkScalar xpos[], SkScalar constY, | 1341 const SkScalar xpos[], SkScalar constY, |
1167 const SkPaint& paint) { | 1342 const SkPaint& paint) { |
1168 | 1343 |
| 1344 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1345 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1346 #endif |
| 1347 |
1169 const SkFlatData* flatPaintData = this->getFlatPaintData(paint); | 1348 const SkFlatData* flatPaintData = this->getFlatPaintData(paint); |
1170 this->drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData)
; | 1349 this->drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData)
; |
1171 } | 1350 } |
1172 | 1351 |
1173 void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength, | 1352 void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength, |
1174 const SkScalar xpos[], SkScalar constY, | 1353 const SkScalar xpos[], SkScalar constY, |
1175 const SkPaint& paint, const SkFlatData* flatPaintData)
{ | 1354 const SkPaint& paint, const SkFlatData* flatPaintData)
{ |
1176 size_t points = paint.countText(text, byteLength); | 1355 size_t points = paint.countText(text, byteLength); |
1177 if (0 == points) | 1356 if (0 == points) |
1178 return; | 1357 return; |
(...skipping 26 matching lines...) Expand all Loading... |
1205 #ifdef SK_DEBUG_SIZE | 1384 #ifdef SK_DEBUG_SIZE |
1206 fPointBytes += fWriter.bytesWritten() - start; | 1385 fPointBytes += fWriter.bytesWritten() - start; |
1207 fPointWrites += points; | 1386 fPointWrites += points; |
1208 #endif | 1387 #endif |
1209 this->validate(initialOffset, size); | 1388 this->validate(initialOffset, size); |
1210 } | 1389 } |
1211 | 1390 |
1212 void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength, | 1391 void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength, |
1213 const SkPath& path, const SkMatrix* matrix, | 1392 const SkPath& path, const SkMatrix* matrix, |
1214 const SkPaint& paint) { | 1393 const SkPaint& paint) { |
| 1394 |
| 1395 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1396 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1397 #endif |
| 1398 |
1215 // op + paint index + length + 'length' worth of data + path index + matrix | 1399 // op + paint index + length + 'length' worth of data + path index + matrix |
1216 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); | 1400 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
1217 uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.wri
teToMemory(NULL); | 1401 uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.wri
teToMemory(NULL); |
1218 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); | 1402 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); |
1219 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by
tesWritten()); | 1403 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by
tesWritten()); |
1220 this->addPaint(paint); | 1404 this->addPaint(paint); |
1221 this->addText(text, byteLength); | 1405 this->addText(text, byteLength); |
1222 this->addPath(path); | 1406 this->addPath(path); |
1223 this->addMatrix(m); | 1407 this->addMatrix(m); |
1224 this->validate(initialOffset, size); | 1408 this->validate(initialOffset, size); |
1225 } | 1409 } |
1226 | 1410 |
1227 void SkPictureRecord::drawPicture(SkPicture& picture) { | 1411 void SkPictureRecord::drawPicture(SkPicture& picture) { |
| 1412 |
| 1413 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1414 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1415 #endif |
| 1416 |
1228 // op + picture index | 1417 // op + picture index |
1229 uint32_t size = 2 * kUInt32Size; | 1418 uint32_t size = 2 * kUInt32Size; |
1230 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size); | 1419 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size); |
1231 this->addPicture(picture); | 1420 this->addPicture(picture); |
1232 this->validate(initialOffset, size); | 1421 this->validate(initialOffset, size); |
1233 } | 1422 } |
1234 | 1423 |
1235 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, | 1424 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, |
1236 const SkPoint vertices[], const SkPoint texs[], | 1425 const SkPoint vertices[], const SkPoint texs[], |
1237 const SkColor colors[], SkXfermode* xfer, | 1426 const SkColor colors[], SkXfermode* xfer, |
1238 const uint16_t indices[], int indexCount, | 1427 const uint16_t indices[], int indexCount, |
1239 const SkPaint& paint) { | 1428 const SkPaint& paint) { |
| 1429 |
| 1430 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1431 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1432 #endif |
| 1433 |
1240 uint32_t flags = 0; | 1434 uint32_t flags = 0; |
1241 if (texs) { | 1435 if (texs) { |
1242 flags |= DRAW_VERTICES_HAS_TEXS; | 1436 flags |= DRAW_VERTICES_HAS_TEXS; |
1243 } | 1437 } |
1244 if (colors) { | 1438 if (colors) { |
1245 flags |= DRAW_VERTICES_HAS_COLORS; | 1439 flags |= DRAW_VERTICES_HAS_COLORS; |
1246 } | 1440 } |
1247 if (indexCount > 0) { | 1441 if (indexCount > 0) { |
1248 flags |= DRAW_VERTICES_HAS_INDICES; | 1442 flags |= DRAW_VERTICES_HAS_INDICES; |
1249 } | 1443 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 } | 1483 } |
1290 if (flags & DRAW_VERTICES_HAS_XFER) { | 1484 if (flags & DRAW_VERTICES_HAS_XFER) { |
1291 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; | 1485 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; |
1292 (void)xfer->asMode(&mode); | 1486 (void)xfer->asMode(&mode); |
1293 this->addInt(mode); | 1487 this->addInt(mode); |
1294 } | 1488 } |
1295 this->validate(initialOffset, size); | 1489 this->validate(initialOffset, size); |
1296 } | 1490 } |
1297 | 1491 |
1298 void SkPictureRecord::drawData(const void* data, size_t length) { | 1492 void SkPictureRecord::drawData(const void* data, size_t length) { |
| 1493 |
| 1494 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 1495 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
| 1496 #endif |
| 1497 |
1299 // op + length + 'length' worth of data | 1498 // op + length + 'length' worth of data |
1300 uint32_t size = 2 * kUInt32Size + SkAlign4(length); | 1499 uint32_t size = 2 * kUInt32Size + SkAlign4(length); |
1301 size_t initialOffset = this->addDraw(DRAW_DATA, &size); | 1500 size_t initialOffset = this->addDraw(DRAW_DATA, &size); |
1302 this->addInt(length); | 1501 this->addInt(length); |
1303 fWriter.writePad(data, length); | 1502 fWriter.writePad(data, length); |
1304 this->validate(initialOffset, size); | 1503 this->validate(initialOffset, size); |
1305 } | 1504 } |
1306 | 1505 |
1307 void SkPictureRecord::beginCommentGroup(const char* description) { | 1506 void SkPictureRecord::beginCommentGroup(const char* description) { |
1308 // op/size + length of string + \0 terminated chars | 1507 // op/size + length of string + \0 terminated chars |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 void SkPictureRecord::validateRegions() const { | 1778 void SkPictureRecord::validateRegions() const { |
1580 int count = fRegions.count(); | 1779 int count = fRegions.count(); |
1581 SkASSERT((unsigned) count < 0x1000); | 1780 SkASSERT((unsigned) count < 0x1000); |
1582 for (int index = 0; index < count; index++) { | 1781 for (int index = 0; index < count; index++) { |
1583 const SkFlatData* region = fRegions[index]; | 1782 const SkFlatData* region = fRegions[index]; |
1584 SkASSERT(region); | 1783 SkASSERT(region); |
1585 // region->validate(); | 1784 // region->validate(); |
1586 } | 1785 } |
1587 } | 1786 } |
1588 #endif | 1787 #endif |
OLD | NEW |