| 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 "SkPicturePlayback.h" | 8 #include "SkPicturePlayback.h" |
| 9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
| 10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 807 |
| 808 switch (op) { | 808 switch (op) { |
| 809 case CLIP_PATH: { | 809 case CLIP_PATH: { |
| 810 const SkPath& path = getPath(reader); | 810 const SkPath& path = getPath(reader); |
| 811 uint32_t packed = reader.readInt(); | 811 uint32_t packed = reader.readInt(); |
| 812 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 812 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 813 bool doAA = ClipParams_unpackDoAA(packed); | 813 bool doAA = ClipParams_unpackDoAA(packed); |
| 814 size_t offsetToRestore = reader.readInt(); | 814 size_t offsetToRestore = reader.readInt(); |
| 815 SkASSERT(!offsetToRestore || \ | 815 SkASSERT(!offsetToRestore || \ |
| 816 offsetToRestore >= reader.offset()); | 816 offsetToRestore >= reader.offset()); |
| 817 if (!canvas.clipPath(path, regionOp, doAA) && offsetToRestore) { | 817 canvas.clipPath(path, regionOp, doAA); |
| 818 if (canvas.isClipEmpty() && offsetToRestore) { |
| 818 #ifdef SPEW_CLIP_SKIPPING | 819 #ifdef SPEW_CLIP_SKIPPING |
| 819 skipPath.recordSkip(offsetToRestore - reader.offset()); | 820 skipPath.recordSkip(offsetToRestore - reader.offset()); |
| 820 #endif | 821 #endif |
| 821 reader.setOffset(offsetToRestore); | 822 reader.setOffset(offsetToRestore); |
| 822 } | 823 } |
| 823 } break; | 824 } break; |
| 824 case CLIP_REGION: { | 825 case CLIP_REGION: { |
| 825 SkRegion region; | 826 SkRegion region; |
| 826 this->getRegion(reader, ®ion); | 827 this->getRegion(reader, ®ion); |
| 827 uint32_t packed = reader.readInt(); | 828 uint32_t packed = reader.readInt(); |
| 828 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 829 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 829 size_t offsetToRestore = reader.readInt(); | 830 size_t offsetToRestore = reader.readInt(); |
| 830 SkASSERT(!offsetToRestore || \ | 831 SkASSERT(!offsetToRestore || \ |
| 831 offsetToRestore >= reader.offset()); | 832 offsetToRestore >= reader.offset()); |
| 832 if (!canvas.clipRegion(region, regionOp) && offsetToRestore) { | 833 canvas.clipRegion(region, regionOp); |
| 834 if (canvas.isClipEmpty() && offsetToRestore) { |
| 833 #ifdef SPEW_CLIP_SKIPPING | 835 #ifdef SPEW_CLIP_SKIPPING |
| 834 skipRegion.recordSkip(offsetToRestore - reader.offset()); | 836 skipRegion.recordSkip(offsetToRestore - reader.offset()); |
| 835 #endif | 837 #endif |
| 836 reader.setOffset(offsetToRestore); | 838 reader.setOffset(offsetToRestore); |
| 837 } | 839 } |
| 838 } break; | 840 } break; |
| 839 case CLIP_RECT: { | 841 case CLIP_RECT: { |
| 840 const SkRect& rect = reader.skipT<SkRect>(); | 842 const SkRect& rect = reader.skipT<SkRect>(); |
| 841 uint32_t packed = reader.readInt(); | 843 uint32_t packed = reader.readInt(); |
| 842 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 844 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 843 bool doAA = ClipParams_unpackDoAA(packed); | 845 bool doAA = ClipParams_unpackDoAA(packed); |
| 844 size_t offsetToRestore = reader.readInt(); | 846 size_t offsetToRestore = reader.readInt(); |
| 845 SkASSERT(!offsetToRestore || \ | 847 SkASSERT(!offsetToRestore || \ |
| 846 offsetToRestore >= reader.offset()); | 848 offsetToRestore >= reader.offset()); |
| 847 if (!canvas.clipRect(rect, regionOp, doAA) && offsetToRestore) { | 849 canvas.clipRect(rect, regionOp, doAA); |
| 850 if (canvas.isClipEmpty() && offsetToRestore) { |
| 848 #ifdef SPEW_CLIP_SKIPPING | 851 #ifdef SPEW_CLIP_SKIPPING |
| 849 skipRect.recordSkip(offsetToRestore - reader.offset()); | 852 skipRect.recordSkip(offsetToRestore - reader.offset()); |
| 850 #endif | 853 #endif |
| 851 reader.setOffset(offsetToRestore); | 854 reader.setOffset(offsetToRestore); |
| 852 } | 855 } |
| 853 } break; | 856 } break; |
| 854 case CLIP_RRECT: { | 857 case CLIP_RRECT: { |
| 855 SkRRect rrect; | 858 SkRRect rrect; |
| 856 reader.readRRect(&rrect); | 859 reader.readRRect(&rrect); |
| 857 uint32_t packed = reader.readInt(); | 860 uint32_t packed = reader.readInt(); |
| 858 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 861 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 859 bool doAA = ClipParams_unpackDoAA(packed); | 862 bool doAA = ClipParams_unpackDoAA(packed); |
| 860 size_t offsetToRestore = reader.readInt(); | 863 size_t offsetToRestore = reader.readInt(); |
| 861 SkASSERT(!offsetToRestore || \ | 864 SkASSERT(!offsetToRestore || \ |
| 862 offsetToRestore >= reader.offset()); | 865 offsetToRestore >= reader.offset()); |
| 863 if (!canvas.clipRRect(rrect, regionOp, doAA) && offsetToRestore)
{ | 866 canvas.clipRRect(rrect, regionOp, doAA); |
| 867 if (canvas.isClipEmpty() && offsetToRestore) { |
| 864 #ifdef SPEW_CLIP_SKIPPING | 868 #ifdef SPEW_CLIP_SKIPPING |
| 865 skipRRect.recordSkip(offsetToRestore - reader.offset()); | 869 skipRRect.recordSkip(offsetToRestore - reader.offset()); |
| 866 #endif | 870 #endif |
| 867 reader.setOffset(offsetToRestore); | 871 reader.setOffset(offsetToRestore); |
| 868 } | 872 } |
| 869 } break; | 873 } break; |
| 870 case CONCAT: { | 874 case CONCAT: { |
| 871 SkMatrix matrix; | 875 SkMatrix matrix; |
| 872 this->getMatrix(reader, &matrix); | 876 this->getMatrix(reader, &matrix); |
| 873 canvas.concat(matrix); | 877 canvas.concat(matrix); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 for (index = 0; index < fPictureCount; index++) | 1641 for (index = 0; index < fPictureCount; index++) |
| 1638 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1642 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
| 1639 "picture%p, ", fPictureRefs[index]); | 1643 "picture%p, ", fPictureRefs[index]); |
| 1640 if (fPictureCount > 0) | 1644 if (fPictureCount > 0) |
| 1641 SkDebugf("%s0};\n", pBuffer); | 1645 SkDebugf("%s0};\n", pBuffer); |
| 1642 | 1646 |
| 1643 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1647 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
| 1644 } | 1648 } |
| 1645 | 1649 |
| 1646 #endif | 1650 #endif |
| OLD | NEW |