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

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

Issue 246893005: Refactor SkPictureStateTree::Iterator to avoid use of kClip_SaveFlag. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated per comments. Created 6 years, 7 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 | « gyp/tests.gypi ('k') | src/core/SkPictureStateTree.h » ('j') | 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 "SkPicturePlayback.h" 9 #include "SkPicturePlayback.h"
10 #include "SkPictureRecord.h" 10 #include "SkPictureRecord.h"
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 activeOps = &((const CachedOperationList&)activeOpsList).fOps; 844 activeOps = &((const CachedOperationList&)activeOpsList).fOps;
845 } 845 }
846 } 846 }
847 } 847 }
848 848
849 SkPictureStateTree::Iterator it = (NULL == activeOps) ? 849 SkPictureStateTree::Iterator it = (NULL == activeOps) ?
850 SkPictureStateTree::Iterator() : 850 SkPictureStateTree::Iterator() :
851 fStateTree->getIterator(*activeOps, &canvas); 851 fStateTree->getIterator(*activeOps, &canvas);
852 852
853 if (it.isValid()) { 853 if (it.isValid()) {
854 uint32_t skipTo = it.draw(); 854 uint32_t skipTo = it.nextDraw();
855 if (kDrawComplete == skipTo) { 855 if (kDrawComplete == skipTo) {
856 return; 856 return;
857 } 857 }
858 reader.setOffset(skipTo); 858 reader.setOffset(skipTo);
859 } 859 }
860 860
861 // Record this, so we can concat w/ it if we encounter a setMatrix() 861 // Record this, so we can concat w/ it if we encounter a setMatrix()
862 SkMatrix initialMatrix = canvas.getTotalMatrix(); 862 SkMatrix initialMatrix = canvas.getTotalMatrix();
863 int originalSaveCount = canvas.getSaveCount(); 863 int originalSaveCount = canvas.getSaveCount();
864 864
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 900 }
901 #endif 901 #endif
902 } 902 }
903 903
904 if (0 != skipTo) { 904 if (0 != skipTo) {
905 if (it.isValid()) { 905 if (it.isValid()) {
906 // If using a bounding box hierarchy, advance the state tree 906 // If using a bounding box hierarchy, advance the state tree
907 // iterator until at or after skipTo 907 // iterator until at or after skipTo
908 uint32_t adjustedSkipTo; 908 uint32_t adjustedSkipTo;
909 do { 909 do {
910 adjustedSkipTo = it.draw(); 910 adjustedSkipTo = it.nextDraw();
911 } while (adjustedSkipTo < skipTo); 911 } while (adjustedSkipTo < skipTo);
912 skipTo = adjustedSkipTo; 912 skipTo = adjustedSkipTo;
913 } 913 }
914 if (kDrawComplete == skipTo) { 914 if (kDrawComplete == skipTo) {
915 break; 915 break;
916 } 916 }
917 reader.setOffset(skipTo); 917 reader.setOffset(skipTo);
918 continue; 918 continue;
919 } 919 }
920 920
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } break; 1239 } break;
1240 default: 1240 default:
1241 SkASSERT(0); 1241 SkASSERT(0);
1242 } 1242 }
1243 1243
1244 #ifdef SK_DEVELOPER 1244 #ifdef SK_DEVELOPER
1245 this->postDraw(opIndex); 1245 this->postDraw(opIndex);
1246 #endif 1246 #endif
1247 1247
1248 if (it.isValid()) { 1248 if (it.isValid()) {
1249 uint32_t skipTo = it.draw(); 1249 uint32_t skipTo = it.nextDraw();
1250 if (kDrawComplete == skipTo) { 1250 if (kDrawComplete == skipTo) {
1251 break; 1251 break;
1252 } 1252 }
1253 reader.setOffset(skipTo); 1253 reader.setOffset(skipTo);
1254 } 1254 }
1255 } 1255 }
1256 1256
1257 #ifdef SPEW_CLIP_SKIPPING 1257 #ifdef SPEW_CLIP_SKIPPING
1258 { 1258 {
1259 size_t size = skipRect.fSize + skipRRect.fSize + skipPath.fSize + skipR egion.fSize + 1259 size_t size = skipRect.fSize + skipRRect.fSize + skipPath.fSize + skipR egion.fSize +
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 for (index = 0; index < fPictureCount; index++) 1771 for (index = 0; index < fPictureCount; index++)
1772 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1772 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1773 "picture%p, ", fPictureRefs[index]); 1773 "picture%p, ", fPictureRefs[index]);
1774 if (fPictureCount > 0) 1774 if (fPictureCount > 0)
1775 SkDebugf("%s0};\n", pBuffer); 1775 SkDebugf("%s0};\n", pBuffer);
1776 1776
1777 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1777 const_cast<SkPicturePlayback*>(this)->dumpStream();
1778 } 1778 }
1779 1779
1780 #endif 1780 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkPictureStateTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698