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

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

Issue 12817011: Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierar… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkPictureRecord.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 /* 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 "SkPicturePlayback.h" 8 #include "SkPicturePlayback.h"
9 #include "SkPictureRecord.h" 9 #include "SkPictureRecord.h"
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 while (!reader.eof()) { 708 while (!reader.eof()) {
709 #ifdef SK_BUILD_FOR_ANDROID 709 #ifdef SK_BUILD_FOR_ANDROID
710 if (fAbortCurrentPlayback) { 710 if (fAbortCurrentPlayback) {
711 return; 711 return;
712 } 712 }
713 #endif 713 #endif
714 714
715 size_t curOffset = reader.offset(); 715 size_t curOffset = reader.offset();
716 uint32_t size; 716 uint32_t size;
717 DrawType op = read_op_and_size(&reader, &size); 717 DrawType op = read_op_and_size(&reader, &size);
718 if (NOOP == op) { 718 size_t skipTo = 0;
719 #ifdef SK_DEVELOPER
720 // TODO: once chunk sizes are in all .skps just use
721 // "curOffset + size"
722 skipTo = this->preDraw(curOffset, op);
723 #endif
724 if (0 == skipTo && NOOP == op) {
719 // NOOPs are to be ignored - do not propagate them any further 725 // NOOPs are to be ignored - do not propagate them any further
720 reader.setOffset(curOffset+size); 726 skipTo = curOffset + size;
721 continue;
722 } 727 }
723 728
724 #ifdef SK_DEVELOPER
725 // TODO: once chunk sizes are in all .skps just use "curOffset + size"
726 size_t skipTo = this->preDraw(curOffset, op);
727 if (0 != skipTo) { 729 if (0 != skipTo) {
730 if (it.isValid()) {
731 // If using a bounding box hierarchy, advance the state tree
732 // iterator until at or after skipTo
733 uint32_t adjustedSkipTo;
734 do {
735 adjustedSkipTo = it.draw();
736 } while (adjustedSkipTo < skipTo);
737 skipTo = adjustedSkipTo;
738 }
728 if (kDrawComplete == skipTo) { 739 if (kDrawComplete == skipTo) {
729 break; 740 break;
730 } 741 }
731 reader.setOffset(skipTo); 742 reader.setOffset(skipTo);
732 continue; 743 continue;
733 } 744 }
734 #endif 745
735 switch (op) { 746 switch (op) {
736 case CLIP_PATH: { 747 case CLIP_PATH: {
737 const SkPath& path = getPath(reader); 748 const SkPath& path = getPath(reader);
738 uint32_t packed = reader.readInt(); 749 uint32_t packed = reader.readInt();
739 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); 750 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
740 bool doAA = ClipParams_unpackDoAA(packed); 751 bool doAA = ClipParams_unpackDoAA(packed);
741 size_t offsetToRestore = reader.readInt(); 752 size_t offsetToRestore = reader.readInt();
742 SkASSERT(!offsetToRestore || \ 753 SkASSERT(!offsetToRestore || \
743 offsetToRestore >= reader.offset()); 754 offsetToRestore >= reader.offset());
744 if (!canvas.clipPath(path, regionOp, doAA) && offsetToRestore) { 755 if (!canvas.clipPath(path, regionOp, doAA) && offsetToRestore) {
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 for (index = 0; index < fRegionCount; index++) 1581 for (index = 0; index < fRegionCount; index++)
1571 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1582 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1572 "region%p, ", &fRegions[index]); 1583 "region%p, ", &fRegions[index]);
1573 if (fRegionCount > 0) 1584 if (fRegionCount > 0)
1574 SkDebugf("%s0};\n", pBuffer); 1585 SkDebugf("%s0};\n", pBuffer);
1575 1586
1576 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1587 const_cast<SkPicturePlayback*>(this)->dumpStream();
1577 } 1588 }
1578 1589
1579 #endif 1590 #endif
OLDNEW
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698