OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkLayerInfo.h" | 8 #include "SkLayerInfo.h" |
9 #include "SkRecordDraw.h" | 9 #include "SkRecordDraw.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 if (src.fPaint) { | 684 if (src.fPaint) { |
685 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); | 685 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); |
686 } | 686 } |
687 dst.fSaveLayerOpID = src.fSaveLayerOpID; | 687 dst.fSaveLayerOpID = src.fSaveLayerOpID; |
688 dst.fRestoreOpID = src.fRestoreOpID; | 688 dst.fRestoreOpID = src.fRestoreOpID; |
689 dst.fHasNestedLayers = src.fHasNestedLayers; | 689 dst.fHasNestedLayers = src.fHasNestedLayers; |
690 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; | 690 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; |
691 | 691 |
692 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' | 692 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' |
693 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; | 693 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; |
694 dst.fKey = SkNEW_ARRAY(int, dst.fKeySize); | 694 dst.fKey = SkNEW_ARRAY(unsigned, dst.fKeySize); |
695 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count(
) * sizeof(int)); | 695 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count(
) * sizeof(unsigned)); |
696 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); | 696 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); |
697 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(int)); | 697 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(unsigned)); |
698 } | 698 } |
699 } | 699 } |
700 | 700 |
701 void trackSaveLayers(const DrawPicture& dp) { | 701 void trackSaveLayers(const DrawPicture& dp) { |
702 this->trackSaveLayersForPicture(dp.picture, dp.paint); | 702 this->trackSaveLayersForPicture(dp.picture, dp.paint); |
703 } | 703 } |
704 | 704 |
705 void trackSaveLayers(const DrawDrawable& dp) { | 705 void trackSaveLayers(const DrawDrawable& dp) { |
706 SkASSERT(fPictList); | 706 SkASSERT(fPictList); |
707 SkASSERT(dp.index >= 0 && dp.index < fPictList->count()); | 707 SkASSERT(dp.index >= 0 && dp.index < fPictList->count()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 block.fPreMat = SkMatrix::I(); | 759 block.fPreMat = SkMatrix::I(); |
760 if (sli.fPaint) { | 760 if (sli.fPaint) { |
761 block.fPaint = SkNEW_ARGS(SkPaint, (*sli.fPaint)); | 761 block.fPaint = SkNEW_ARGS(SkPaint, (*sli.fPaint)); |
762 } | 762 } |
763 block.fSaveLayerOpID = sli.fStartIndex; | 763 block.fSaveLayerOpID = sli.fStartIndex; |
764 block.fRestoreOpID = fFillBounds.currentOp(); | 764 block.fRestoreOpID = fFillBounds.currentOp(); |
765 block.fHasNestedLayers = sli.fHasNestedSaveLayer; | 765 block.fHasNestedLayers = sli.fHasNestedSaveLayer; |
766 block.fIsNested = fSaveLayersInStack > 0; | 766 block.fIsNested = fSaveLayersInStack > 0; |
767 | 767 |
768 block.fKeySize = fSaveLayerOpStack.count(); | 768 block.fKeySize = fSaveLayerOpStack.count(); |
769 block.fKey = SkNEW_ARRAY(int, block.fKeySize); | 769 block.fKey = SkNEW_ARRAY(unsigned, block.fKeySize); |
770 memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(in
t)); | 770 memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(un
signed)); |
771 | 771 |
772 fSaveLayerOpStack.pop(); | 772 fSaveLayerOpStack.pop(); |
773 } | 773 } |
774 | 774 |
775 // Used to collect saveLayer information for layer hoisting | 775 // Used to collect saveLayer information for layer hoisting |
776 int fSaveLayersInStack; | 776 int fSaveLayersInStack; |
777 SkTDArray<SaveLayerInfo> fSaveLayerStack; | 777 SkTDArray<SaveLayerInfo> fSaveLayerStack; |
778 // The op code indices of all the currently active saveLayers | 778 // The op code indices of all the currently active saveLayers |
779 SkTDArray<int> fSaveLayerOpStack; | 779 SkTDArray<unsigned> fSaveLayerOpStack; |
780 SkLayerInfo* fAccelData; | 780 SkLayerInfo* fAccelData; |
781 const SkPicture::SnapshotArray* fPictList; | 781 const SkPicture::SnapshotArray* fPictList; |
782 | 782 |
783 SkRecords::FillBounds fFillBounds; | 783 SkRecords::FillBounds fFillBounds; |
784 }; | 784 }; |
785 | 785 |
786 } // namespace SkRecords | 786 } // namespace SkRecords |
787 | 787 |
788 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkBBoxHi
erarchy* bbh) { | 788 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkBBoxHi
erarchy* bbh) { |
789 SkRecords::FillBounds visitor(cullRect, record); | 789 SkRecords::FillBounds visitor(cullRect, record); |
(...skipping 12 matching lines...) Expand all Loading... |
802 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); | 802 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); |
803 | 803 |
804 for (unsigned curOp = 0; curOp < record.count(); curOp++) { | 804 for (unsigned curOp = 0; curOp < record.count(); curOp++) { |
805 visitor.setCurrentOp(curOp); | 805 visitor.setCurrentOp(curOp); |
806 record.visit<void>(curOp, visitor); | 806 record.visit<void>(curOp, visitor); |
807 } | 807 } |
808 | 808 |
809 visitor.cleanUp(bbh); | 809 visitor.cleanUp(bbh); |
810 } | 810 } |
811 | 811 |
OLD | NEW |