Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: src/core/SkPicturePlayback.cpp

Issue 235473002: remove dead code from SkPicturePlayback (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <new> 7 #include <new>
8 #include "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkOffsetTable.h" 9 #include "SkOffsetTable.h"
10 #include "SkPicturePlayback.h" 10 #include "SkPicturePlayback.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 *size = 0; 758 *size = 0;
759 } else { 759 } else {
760 UNPACK_8_24(temp, op, *size); 760 UNPACK_8_24(temp, op, *size);
761 if (MASK_24 == *size) { 761 if (MASK_24 == *size) {
762 *size = reader->readInt(); 762 *size = reader->readInt();
763 } 763 }
764 } 764 }
765 return (DrawType) op; 765 return (DrawType) op;
766 } 766 }
767 767
768 // The activeOps parameter is actually "const SkTDArray<SkPictureStateTree::Draw *>&".
769 // It represents the operations about to be drawn, as generated by some spatial
770 // subdivision helper class. It should already be in 'fOffset' sorted order.
771 void SkPicturePlayback::preLoadBitmaps(const SkTDArray<void*>* activeOps) {
772 if ((NULL != activeOps && 0 == activeOps->count()) || NULL == fBitmapUseOffs ets) {
773 return;
774 }
775
776 if (NULL == activeOps) {
777 // going to need everything
778 return;
779 }
780
781 SkTDArray<int> active;
782
783 SkAutoTDeleteArray<bool> needToCheck(new bool[fBitmapUseOffsets->numIDs()]);
784 for (int i = 0; i < fBitmapUseOffsets->numIDs(); ++i) {
785 needToCheck.get()[i] = true;
786 }
787
788 uint32_t max = ((SkPictureStateTree::Draw*)(*activeOps)[(*activeOps).count() -1])->fOffset;
789
790 for (int i = 0; i < activeOps->count(); ++i) {
791 SkPictureStateTree::Draw* draw = (SkPictureStateTree::Draw*) (*activeOps )[i];
792
793 for (int j = 0; j < fBitmapUseOffsets->numIDs(); ++j) {
794 if (!needToCheck.get()[j]) {
795 continue;
796 }
797
798 if (!fBitmapUseOffsets->overlap(j, draw->fOffset, max)) {
799 needToCheck.get()[j] = false;
800 continue;
801 }
802
803 if (!fBitmapUseOffsets->includes(j, draw->fOffset)) {
804 continue;
805 }
806
807 *active.append() = j;
808 needToCheck.get()[j] = false;
809 }
810 }
811
812 for (int i = 0; i < active.count(); ++i) {
813 SkDebugf("preload texture %d\n", active[i]);
814 }
815 }
816
817 uint32_t SkPicturePlayback::CachedOperationList::offset(int index) const { 768 uint32_t SkPicturePlayback::CachedOperationList::offset(int index) const {
818 SkASSERT(index < fOps.count()); 769 SkASSERT(index < fOps.count());
819 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset; 770 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset;
820 } 771 }
821 772
822 const SkMatrix& SkPicturePlayback::CachedOperationList::matrix(int index) const { 773 const SkMatrix& SkPicturePlayback::CachedOperationList::matrix(int index) const {
823 SkASSERT(index < fOps.count()); 774 SkASSERT(index < fOps.count());
824 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix; 775 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix;
825 } 776 }
826 777
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 fStateTree->getIterator(*activeOps, &canvas); 862 fStateTree->getIterator(*activeOps, &canvas);
912 863
913 if (it.isValid()) { 864 if (it.isValid()) {
914 uint32_t skipTo = it.draw(); 865 uint32_t skipTo = it.draw();
915 if (kDrawComplete == skipTo) { 866 if (kDrawComplete == skipTo) {
916 return; 867 return;
917 } 868 }
918 reader.setOffset(skipTo); 869 reader.setOffset(skipTo);
919 } 870 }
920 871
921 this->preLoadBitmaps(activeOps);
922
923 // Record this, so we can concat w/ it if we encounter a setMatrix() 872 // Record this, so we can concat w/ it if we encounter a setMatrix()
924 SkMatrix initialMatrix = canvas.getTotalMatrix(); 873 SkMatrix initialMatrix = canvas.getTotalMatrix();
925 int originalSaveCount = canvas.getSaveCount(); 874 int originalSaveCount = canvas.getSaveCount();
926 875
927 #ifdef SK_BUILD_FOR_ANDROID 876 #ifdef SK_BUILD_FOR_ANDROID
928 fAbortCurrentPlayback = false; 877 fAbortCurrentPlayback = false;
929 #endif 878 #endif
930 879
931 #ifdef SK_DEVELOPER 880 #ifdef SK_DEVELOPER
932 int opIndex = -1; 881 int opIndex = -1;
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 for (index = 0; index < fPictureCount; index++) 1782 for (index = 0; index < fPictureCount; index++)
1834 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1783 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1835 "picture%p, ", fPictureRefs[index]); 1784 "picture%p, ", fPictureRefs[index]);
1836 if (fPictureCount > 0) 1785 if (fPictureCount > 0)
1837 SkDebugf("%s0};\n", pBuffer); 1786 SkDebugf("%s0};\n", pBuffer);
1838 1787
1839 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1788 const_cast<SkPicturePlayback*>(this)->dumpStream();
1840 } 1789 }
1841 1790
1842 #endif 1791 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698