diff options
author | 2013-03-15 15:06:03 +0000 | |
---|---|---|
committer | 2013-03-15 15:06:03 +0000 | |
commit | 4b32bd53c63b245707822ae83e3215863303bf43 (patch) | |
tree | 65b7a903a262019d5f0c4d7d42a2eeffbf253d0f /src/core/SkPicturePlayback.cpp | |
parent | 8b5144f366db1dd88ac420b38b6871aea0ae8ca4 (diff) |
Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierarchies
BUG=https://code.google.com/p/chromium/issues/detail?id=180645
TEST=render_pictures -r <skp_dir> --validate --bbh <grid|rtree> --mode tile 256 256
Author: junov@chromium.org
Reviewed By: robertphillips@google.com
Review URL: https://chromiumcodereview.appspot.com/12817011
git-svn-id: http://skia.googlecode.com/svn/trunk@8171 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPicturePlayback.cpp')
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 93e5cf17bf..22125ee02b 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -715,23 +715,34 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { size_t curOffset = reader.offset(); uint32_t size; DrawType op = read_op_and_size(&reader, &size); - if (NOOP == op) { + size_t skipTo = 0; +#ifdef SK_DEVELOPER + // TODO: once chunk sizes are in all .skps just use + // "curOffset + size" + skipTo = this->preDraw(curOffset, op); +#endif + if (0 == skipTo && NOOP == op) { // NOOPs are to be ignored - do not propagate them any further - reader.setOffset(curOffset+size); - continue; + skipTo = curOffset + size; } -#ifdef SK_DEVELOPER - // TODO: once chunk sizes are in all .skps just use "curOffset + size" - size_t skipTo = this->preDraw(curOffset, op); if (0 != skipTo) { + if (it.isValid()) { + // If using a bounding box hierarchy, advance the state tree + // iterator until at or after skipTo + uint32_t adjustedSkipTo; + do { + adjustedSkipTo = it.draw(); + } while (adjustedSkipTo < skipTo); + skipTo = adjustedSkipTo; + } if (kDrawComplete == skipTo) { break; } reader.setOffset(skipTo); continue; } -#endif + switch (op) { case CLIP_PATH: { const SkPath& path = getPath(reader); |