| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // If src.fPicture is NULL the layer is in dp.picture; otherwise | 680 // If src.fPicture is NULL the layer is in dp.picture; otherwise |
| 681 // it belongs to a sub-picture. | 681 // it belongs to a sub-picture. |
| 682 dst.fPicture = src.fPicture ? src.fPicture : picture; | 682 dst.fPicture = src.fPicture ? src.fPicture : picture; |
| 683 dst.fPicture->ref(); | 683 dst.fPicture->ref(); |
| 684 dst.fBounds = newBound; | 684 dst.fBounds = newBound; |
| 685 dst.fSrcBounds = src.fSrcBounds; | 685 dst.fSrcBounds = src.fSrcBounds; |
| 686 dst.fLocalMat = src.fLocalMat; | 686 dst.fLocalMat = src.fLocalMat; |
| 687 dst.fPreMat = src.fPreMat; | 687 dst.fPreMat = src.fPreMat; |
| 688 dst.fPreMat.postConcat(fFillBounds.ctm()); | 688 dst.fPreMat.postConcat(fFillBounds.ctm()); |
| 689 if (src.fPaint) { | 689 if (src.fPaint) { |
| 690 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); | 690 dst.fPaint = new SkPaint(*src.fPaint); |
| 691 } | 691 } |
| 692 dst.fSaveLayerOpID = src.fSaveLayerOpID; | 692 dst.fSaveLayerOpID = src.fSaveLayerOpID; |
| 693 dst.fRestoreOpID = src.fRestoreOpID; | 693 dst.fRestoreOpID = src.fRestoreOpID; |
| 694 dst.fHasNestedLayers = src.fHasNestedLayers; | 694 dst.fHasNestedLayers = src.fHasNestedLayers; |
| 695 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; | 695 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; |
| 696 | 696 |
| 697 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' | 697 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' |
| 698 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; | 698 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; |
| 699 dst.fKey = SkNEW_ARRAY(int, dst.fKeySize); | 699 dst.fKey = new int[dst.fKeySize]; |
| 700 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count(
) * sizeof(int)); | 700 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count(
) * sizeof(int)); |
| 701 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); | 701 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); |
| 702 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(int)); | 702 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(int)); |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 | 705 |
| 706 void trackSaveLayers(const DrawPicture& dp) { | 706 void trackSaveLayers(const DrawPicture& dp) { |
| 707 this->trackSaveLayersForPicture(dp.picture, dp.paint); | 707 this->trackSaveLayersForPicture(dp.picture, dp.paint); |
| 708 } | 708 } |
| 709 | 709 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 --fSaveLayersInStack; | 756 --fSaveLayersInStack; |
| 757 | 757 |
| 758 SkLayerInfo::BlockInfo& block = fAccelData->addBlock(); | 758 SkLayerInfo::BlockInfo& block = fAccelData->addBlock(); |
| 759 | 759 |
| 760 SkASSERT(NULL == block.fPicture); // This layer is in the top-most pict
ure | 760 SkASSERT(NULL == block.fPicture); // This layer is in the top-most pict
ure |
| 761 | 761 |
| 762 block.fBounds = fFillBounds.getBounds(sli.fStartIndex); | 762 block.fBounds = fFillBounds.getBounds(sli.fStartIndex); |
| 763 block.fLocalMat = fFillBounds.ctm(); | 763 block.fLocalMat = fFillBounds.ctm(); |
| 764 block.fPreMat = SkMatrix::I(); | 764 block.fPreMat = SkMatrix::I(); |
| 765 if (sli.fPaint) { | 765 if (sli.fPaint) { |
| 766 block.fPaint = SkNEW_ARGS(SkPaint, (*sli.fPaint)); | 766 block.fPaint = new SkPaint(*sli.fPaint); |
| 767 } | 767 } |
| 768 | 768 |
| 769 block.fSrcBounds = sli.fBounds; | 769 block.fSrcBounds = sli.fBounds; |
| 770 block.fSaveLayerOpID = sli.fStartIndex; | 770 block.fSaveLayerOpID = sli.fStartIndex; |
| 771 block.fRestoreOpID = fFillBounds.currentOp(); | 771 block.fRestoreOpID = fFillBounds.currentOp(); |
| 772 block.fHasNestedLayers = sli.fHasNestedSaveLayer; | 772 block.fHasNestedLayers = sli.fHasNestedSaveLayer; |
| 773 block.fIsNested = fSaveLayersInStack > 0; | 773 block.fIsNested = fSaveLayersInStack > 0; |
| 774 | 774 |
| 775 block.fKeySize = fSaveLayerOpStack.count(); | 775 block.fKeySize = fSaveLayerOpStack.count(); |
| 776 block.fKey = SkNEW_ARRAY(int, block.fKeySize); | 776 block.fKey = new int[block.fKeySize]; |
| 777 memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(in
t)); | 777 memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(in
t)); |
| 778 | 778 |
| 779 fSaveLayerOpStack.pop(); | 779 fSaveLayerOpStack.pop(); |
| 780 } | 780 } |
| 781 | 781 |
| 782 // Used to collect saveLayer information for layer hoisting | 782 // Used to collect saveLayer information for layer hoisting |
| 783 int fSaveLayersInStack; | 783 int fSaveLayersInStack; |
| 784 SkTDArray<SaveLayerInfo> fSaveLayerStack; | 784 SkTDArray<SaveLayerInfo> fSaveLayerStack; |
| 785 // The op code indices of all the currently active saveLayers | 785 // The op code indices of all the currently active saveLayers |
| 786 SkTDArray<int> fSaveLayerOpStack; | 786 SkTDArray<int> fSaveLayerOpStack; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 809 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); | 809 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); |
| 810 | 810 |
| 811 for (int curOp = 0; curOp < record.count(); curOp++) { | 811 for (int curOp = 0; curOp < record.count(); curOp++) { |
| 812 visitor.setCurrentOp(curOp); | 812 visitor.setCurrentOp(curOp); |
| 813 record.visit<void>(curOp, visitor); | 813 record.visit<void>(curOp, visitor); |
| 814 } | 814 } |
| 815 | 815 |
| 816 visitor.cleanUp(bbh); | 816 visitor.cleanUp(bbh); |
| 817 } | 817 } |
| 818 | 818 |
| OLD | NEW |