| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 812 |
| 813 switch (op) { | 813 switch (op) { |
| 814 case CLIP_PATH: { | 814 case CLIP_PATH: { |
| 815 const SkPath& path = getPath(reader); | 815 const SkPath& path = getPath(reader); |
| 816 uint32_t packed = reader.readInt(); | 816 uint32_t packed = reader.readInt(); |
| 817 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 817 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 818 bool doAA = ClipParams_unpackDoAA(packed); | 818 bool doAA = ClipParams_unpackDoAA(packed); |
| 819 size_t offsetToRestore = reader.readInt(); | 819 size_t offsetToRestore = reader.readInt(); |
| 820 SkASSERT(!offsetToRestore || \ | 820 SkASSERT(!offsetToRestore || \ |
| 821 offsetToRestore >= reader.offset()); | 821 offsetToRestore >= reader.offset()); |
| 822 if (!canvas.clipPath(path, regionOp, doAA) && offsetToRestore) { | 822 canvas.clipPath(path, regionOp, doAA); |
| 823 if (canvas.isClipEmpty() && offsetToRestore) { |
| 823 #ifdef SPEW_CLIP_SKIPPING | 824 #ifdef SPEW_CLIP_SKIPPING |
| 824 skipPath.recordSkip(offsetToRestore - reader.offset()); | 825 skipPath.recordSkip(offsetToRestore - reader.offset()); |
| 825 #endif | 826 #endif |
| 826 reader.setOffset(offsetToRestore); | 827 reader.setOffset(offsetToRestore); |
| 827 } | 828 } |
| 828 } break; | 829 } break; |
| 829 case CLIP_REGION: { | 830 case CLIP_REGION: { |
| 830 SkRegion region; | 831 SkRegion region; |
| 831 this->getRegion(reader, ®ion); | 832 this->getRegion(reader, ®ion); |
| 832 uint32_t packed = reader.readInt(); | 833 uint32_t packed = reader.readInt(); |
| 833 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 834 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 834 size_t offsetToRestore = reader.readInt(); | 835 size_t offsetToRestore = reader.readInt(); |
| 835 SkASSERT(!offsetToRestore || \ | 836 SkASSERT(!offsetToRestore || \ |
| 836 offsetToRestore >= reader.offset()); | 837 offsetToRestore >= reader.offset()); |
| 837 if (!canvas.clipRegion(region, regionOp) && offsetToRestore) { | 838 canvas.clipRegion(region, regionOp); |
| 839 if (canvas.isClipEmpty() && offsetToRestore) { |
| 838 #ifdef SPEW_CLIP_SKIPPING | 840 #ifdef SPEW_CLIP_SKIPPING |
| 839 skipRegion.recordSkip(offsetToRestore - reader.offset()); | 841 skipRegion.recordSkip(offsetToRestore - reader.offset()); |
| 840 #endif | 842 #endif |
| 841 reader.setOffset(offsetToRestore); | 843 reader.setOffset(offsetToRestore); |
| 842 } | 844 } |
| 843 } break; | 845 } break; |
| 844 case CLIP_RECT: { | 846 case CLIP_RECT: { |
| 845 const SkRect& rect = reader.skipT<SkRect>(); | 847 const SkRect& rect = reader.skipT<SkRect>(); |
| 846 uint32_t packed = reader.readInt(); | 848 uint32_t packed = reader.readInt(); |
| 847 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 849 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 848 bool doAA = ClipParams_unpackDoAA(packed); | 850 bool doAA = ClipParams_unpackDoAA(packed); |
| 849 size_t offsetToRestore = reader.readInt(); | 851 size_t offsetToRestore = reader.readInt(); |
| 850 SkASSERT(!offsetToRestore || \ | 852 SkASSERT(!offsetToRestore || \ |
| 851 offsetToRestore >= reader.offset()); | 853 offsetToRestore >= reader.offset()); |
| 852 if (!canvas.clipRect(rect, regionOp, doAA) && offsetToRestore) { | 854 canvas.clipRect(rect, regionOp, doAA); |
| 855 if (canvas.isClipEmpty() && offsetToRestore) { |
| 853 #ifdef SPEW_CLIP_SKIPPING | 856 #ifdef SPEW_CLIP_SKIPPING |
| 854 skipRect.recordSkip(offsetToRestore - reader.offset()); | 857 skipRect.recordSkip(offsetToRestore - reader.offset()); |
| 855 #endif | 858 #endif |
| 856 reader.setOffset(offsetToRestore); | 859 reader.setOffset(offsetToRestore); |
| 857 } | 860 } |
| 858 } break; | 861 } break; |
| 859 case CLIP_RRECT: { | 862 case CLIP_RRECT: { |
| 860 SkRRect rrect; | 863 SkRRect rrect; |
| 861 reader.readRRect(&rrect); | 864 reader.readRRect(&rrect); |
| 862 uint32_t packed = reader.readInt(); | 865 uint32_t packed = reader.readInt(); |
| 863 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 866 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 864 bool doAA = ClipParams_unpackDoAA(packed); | 867 bool doAA = ClipParams_unpackDoAA(packed); |
| 865 size_t offsetToRestore = reader.readInt(); | 868 size_t offsetToRestore = reader.readInt(); |
| 866 SkASSERT(!offsetToRestore || \ | 869 SkASSERT(!offsetToRestore || \ |
| 867 offsetToRestore >= reader.offset()); | 870 offsetToRestore >= reader.offset()); |
| 868 if (!canvas.clipRRect(rrect, regionOp, doAA) && offsetToRestore)
{ | 871 canvas.clipRRect(rrect, regionOp, doAA); |
| 872 if (canvas.isClipEmpty() && offsetToRestore) { |
| 869 #ifdef SPEW_CLIP_SKIPPING | 873 #ifdef SPEW_CLIP_SKIPPING |
| 870 skipRRect.recordSkip(offsetToRestore - reader.offset()); | 874 skipRRect.recordSkip(offsetToRestore - reader.offset()); |
| 871 #endif | 875 #endif |
| 872 reader.setOffset(offsetToRestore); | 876 reader.setOffset(offsetToRestore); |
| 873 } | 877 } |
| 874 } break; | 878 } break; |
| 875 case PUSH_CULL: { | 879 case PUSH_CULL: { |
| 876 const SkRect& cullRect = reader.skipT<SkRect>(); | 880 const SkRect& cullRect = reader.skipT<SkRect>(); |
| 877 size_t offsetToRestore = reader.readInt(); | 881 size_t offsetToRestore = reader.readInt(); |
| 878 if (offsetToRestore && canvas.quickReject(cullRect)) { | 882 if (offsetToRestore && canvas.quickReject(cullRect)) { |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 for (index = 0; index < fPictureCount; index++) | 1663 for (index = 0; index < fPictureCount; index++) |
| 1660 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1664 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
| 1661 "picture%p, ", fPictureRefs[index]); | 1665 "picture%p, ", fPictureRefs[index]); |
| 1662 if (fPictureCount > 0) | 1666 if (fPictureCount > 0) |
| 1663 SkDebugf("%s0};\n", pBuffer); | 1667 SkDebugf("%s0};\n", pBuffer); |
| 1664 | 1668 |
| 1665 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1669 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
| 1666 } | 1670 } |
| 1667 | 1671 |
| 1668 #endif | 1672 #endif |
| OLD | NEW |