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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 dst.fPaint = new SkPaint(*src.fPaint); | 686 dst.fPaint = new SkPaint(*src.fPaint); |
687 } | 687 } |
688 dst.fSaveLayerOpID = src.fSaveLayerOpID; | 688 dst.fSaveLayerOpID = src.fSaveLayerOpID; |
689 dst.fRestoreOpID = src.fRestoreOpID; | 689 dst.fRestoreOpID = src.fRestoreOpID; |
690 dst.fHasNestedLayers = src.fHasNestedLayers; | 690 dst.fHasNestedLayers = src.fHasNestedLayers; |
691 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; | 691 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; |
692 | 692 |
693 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' | 693 // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops
from sub-picture' |
694 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; | 694 dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1; |
695 dst.fKey = new int[dst.fKeySize]; | 695 dst.fKey = new int[dst.fKeySize]; |
696 memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count(
) * sizeof(int)); | 696 sk_careful_memcpy(dst.fKey, fSaveLayerOpStack.begin(), |
| 697 fSaveLayerOpStack.count() * sizeof(int)); |
697 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); | 698 dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp(); |
698 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(int)); | 699 memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySiz
e * sizeof(int)); |
699 } | 700 } |
700 } | 701 } |
701 | 702 |
702 void trackSaveLayers(const DrawPicture& dp) { | 703 void trackSaveLayers(const DrawPicture& dp) { |
703 this->trackSaveLayersForPicture(dp.picture, dp.paint); | 704 this->trackSaveLayersForPicture(dp.picture, dp.paint); |
704 } | 705 } |
705 | 706 |
706 void trackSaveLayers(const DrawDrawable& dp) { | 707 void trackSaveLayers(const DrawDrawable& dp) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], | 801 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], |
801 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { | 802 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { |
802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); | 803 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); |
803 for (int curOp = 0; curOp < record.count(); curOp++) { | 804 for (int curOp = 0; curOp < record.count(); curOp++) { |
804 visitor.setCurrentOp(curOp); | 805 visitor.setCurrentOp(curOp); |
805 record.visit<void>(curOp, visitor); | 806 record.visit<void>(curOp, visitor); |
806 } | 807 } |
807 visitor.cleanUp(); | 808 visitor.cleanUp(); |
808 } | 809 } |
809 | 810 |
OLD | NEW |