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 <new> | 8 #include <new> |
9 #include "SkBBoxHierarchy.h" | 9 #include "SkBBoxHierarchy.h" |
10 #include "SkOffsetTable.h" | 10 #include "SkOffsetTable.h" |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 if (MASK_24 == *size) { | 718 if (MASK_24 == *size) { |
719 *size = reader->readInt(); | 719 *size = reader->readInt(); |
720 } | 720 } |
721 } | 721 } |
722 return (DrawType) op; | 722 return (DrawType) op; |
723 } | 723 } |
724 | 724 |
725 // The activeOps parameter is actually "const SkTDArray<SkPictureStateTree::Draw
*>&". | 725 // The activeOps parameter is actually "const SkTDArray<SkPictureStateTree::Draw
*>&". |
726 // It represents the operations about to be drawn, as generated by some spatial | 726 // It represents the operations about to be drawn, as generated by some spatial |
727 // subdivision helper class. It should already be in 'fOffset' sorted order. | 727 // subdivision helper class. It should already be in 'fOffset' sorted order. |
728 void SkPicturePlayback::preLoadBitmaps(const SkTDArray<void*>& activeOps) { | 728 void SkPicturePlayback::preLoadBitmaps(SkCanvas& canvas, const SkTDArray<void*>&
activeOps) { |
729 if (0 == activeOps.count() || NULL == fBitmapUseOffsets) { | 729 if (0 == activeOps.count() || NULL == fBitmapUseOffsets) { |
730 return; | 730 return; |
731 } | 731 } |
732 | 732 |
733 SkTDArray<int> active; | 733 SkTDArray<int> active; |
734 | 734 |
735 SkAutoTDeleteArray<bool> needToCheck(new bool[fBitmapUseOffsets->numIDs()]); | 735 SkAutoTDeleteArray<bool> needToCheck(new bool[fBitmapUseOffsets->numIDs()]); |
736 for (int i = 0; i < fBitmapUseOffsets->numIDs(); ++i) { | 736 for (int i = 0; i < fBitmapUseOffsets->numIDs(); ++i) { |
737 needToCheck.get()[i] = true; | 737 needToCheck.get()[i] = true; |
738 } | 738 } |
(...skipping 16 matching lines...) Expand all Loading... |
755 if (!fBitmapUseOffsets->includes(j, draw->fOffset)) { | 755 if (!fBitmapUseOffsets->includes(j, draw->fOffset)) { |
756 continue; | 756 continue; |
757 } | 757 } |
758 | 758 |
759 *active.append() = j; | 759 *active.append() = j; |
760 needToCheck.get()[j] = false; | 760 needToCheck.get()[j] = false; |
761 } | 761 } |
762 } | 762 } |
763 | 763 |
764 for (int i = 0; i < active.count(); ++i) { | 764 for (int i = 0; i < active.count(); ++i) { |
765 SkDebugf("preload texture %d\n", active[i]); | 765 SkASSERT(SkBitmapHeap::INVALID_SLOT != active[i]); |
| 766 canvas.internalPrivate_PreLoad((*fBitmaps)[active[i]], SkIRect::MakeWH(0
, 0)); |
766 } | 767 } |
767 } | 768 } |
768 | 769 |
769 void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback)
{ | 770 void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback)
{ |
770 #ifdef ENABLE_TIME_DRAW | 771 #ifdef ENABLE_TIME_DRAW |
771 SkAutoTime at("SkPicture::draw", 50); | 772 SkAutoTime at("SkPicture::draw", 50); |
772 #endif | 773 #endif |
773 | 774 |
774 #ifdef SPEW_CLIP_SKIPPING | 775 #ifdef SPEW_CLIP_SKIPPING |
775 SkipClipRec skipRect, skipRRect, skipRegion, skipPath, skipCull; | 776 SkipClipRec skipRect, skipRRect, skipRegion, skipPath, skipCull; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 fStateTree->getIterator(activeOps, &canvas); | 809 fStateTree->getIterator(activeOps, &canvas); |
809 | 810 |
810 if (it.isValid()) { | 811 if (it.isValid()) { |
811 uint32_t skipTo = it.draw(); | 812 uint32_t skipTo = it.draw(); |
812 if (kDrawComplete == skipTo) { | 813 if (kDrawComplete == skipTo) { |
813 return; | 814 return; |
814 } | 815 } |
815 reader.setOffset(skipTo); | 816 reader.setOffset(skipTo); |
816 } | 817 } |
817 | 818 |
818 this->preLoadBitmaps(activeOps); | 819 this->preLoadBitmaps(canvas, activeOps); |
819 | 820 |
820 // Record this, so we can concat w/ it if we encounter a setMatrix() | 821 // Record this, so we can concat w/ it if we encounter a setMatrix() |
821 SkMatrix initialMatrix = canvas.getTotalMatrix(); | 822 SkMatrix initialMatrix = canvas.getTotalMatrix(); |
822 int originalSaveCount = canvas.getSaveCount(); | 823 int originalSaveCount = canvas.getSaveCount(); |
823 | 824 |
824 #ifdef SK_BUILD_FOR_ANDROID | 825 #ifdef SK_BUILD_FOR_ANDROID |
825 fAbortCurrentPlayback = false; | 826 fAbortCurrentPlayback = false; |
826 #endif | 827 #endif |
827 | 828 |
828 #ifdef SK_DEVELOPER | 829 #ifdef SK_DEVELOPER |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 for (index = 0; index < fPictureCount; index++) | 1731 for (index = 0; index < fPictureCount; index++) |
1731 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1732 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1732 "picture%p, ", fPictureRefs[index]); | 1733 "picture%p, ", fPictureRefs[index]); |
1733 if (fPictureCount > 0) | 1734 if (fPictureCount > 0) |
1734 SkDebugf("%s0};\n", pBuffer); | 1735 SkDebugf("%s0};\n", pBuffer); |
1735 | 1736 |
1736 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1737 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1737 } | 1738 } |
1738 | 1739 |
1739 #endif | 1740 #endif |
OLD | NEW |