| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SkASSERT(size >= 4); | 99 SkASSERT(size >= 4); |
| 100 reader->skip(size - 4); | 100 reader->skip(size - 4); |
| 101 } break; | 101 } break; |
| 102 case CLIP_PATH: { | 102 case CLIP_PATH: { |
| 103 const SkPath& path = fPictureData->getPath(reader); | 103 const SkPath& path = fPictureData->getPath(reader); |
| 104 uint32_t packed = reader->readInt(); | 104 uint32_t packed = reader->readInt(); |
| 105 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 105 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 106 bool doAA = ClipParams_unpackDoAA(packed); | 106 bool doAA = ClipParams_unpackDoAA(packed); |
| 107 size_t offsetToRestore = reader->readInt(); | 107 size_t offsetToRestore = reader->readInt(); |
| 108 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); | 108 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); |
| 109 canvas->clipPath(path, regionOp, doAA); | 109 canvas->legacyClipPath(path, regionOp, doAA); |
| 110 if (canvas->isClipEmpty() && offsetToRestore) { | 110 if (canvas->isClipEmpty() && offsetToRestore) { |
| 111 reader->setOffset(offsetToRestore); | 111 reader->setOffset(offsetToRestore); |
| 112 } | 112 } |
| 113 } break; | 113 } break; |
| 114 case CLIP_REGION: { | 114 case CLIP_REGION: { |
| 115 SkRegion region; | 115 SkRegion region; |
| 116 reader->readRegion(®ion); | 116 reader->readRegion(®ion); |
| 117 uint32_t packed = reader->readInt(); | 117 uint32_t packed = reader->readInt(); |
| 118 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 118 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 119 size_t offsetToRestore = reader->readInt(); | 119 size_t offsetToRestore = reader->readInt(); |
| 120 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); | 120 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); |
| 121 canvas->clipRegion(region, regionOp); | 121 canvas->legacyClipRegion(region, regionOp); |
| 122 if (canvas->isClipEmpty() && offsetToRestore) { | 122 if (canvas->isClipEmpty() && offsetToRestore) { |
| 123 reader->setOffset(offsetToRestore); | 123 reader->setOffset(offsetToRestore); |
| 124 } | 124 } |
| 125 } break; | 125 } break; |
| 126 case CLIP_RECT: { | 126 case CLIP_RECT: { |
| 127 const SkRect& rect = reader->skipT<SkRect>(); | 127 const SkRect& rect = reader->skipT<SkRect>(); |
| 128 uint32_t packed = reader->readInt(); | 128 uint32_t packed = reader->readInt(); |
| 129 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 129 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 130 bool doAA = ClipParams_unpackDoAA(packed); | 130 bool doAA = ClipParams_unpackDoAA(packed); |
| 131 size_t offsetToRestore = reader->readInt(); | 131 size_t offsetToRestore = reader->readInt(); |
| 132 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); | 132 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); |
| 133 canvas->clipRect(rect, regionOp, doAA); | 133 canvas->legacyClipRect(rect, regionOp, doAA); |
| 134 if (canvas->isClipEmpty() && offsetToRestore) { | 134 if (canvas->isClipEmpty() && offsetToRestore) { |
| 135 reader->setOffset(offsetToRestore); | 135 reader->setOffset(offsetToRestore); |
| 136 } | 136 } |
| 137 } break; | 137 } break; |
| 138 case CLIP_RRECT: { | 138 case CLIP_RRECT: { |
| 139 SkRRect rrect; | 139 SkRRect rrect; |
| 140 reader->readRRect(&rrect); | 140 reader->readRRect(&rrect); |
| 141 uint32_t packed = reader->readInt(); | 141 uint32_t packed = reader->readInt(); |
| 142 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); | 142 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); |
| 143 bool doAA = ClipParams_unpackDoAA(packed); | 143 bool doAA = ClipParams_unpackDoAA(packed); |
| 144 size_t offsetToRestore = reader->readInt(); | 144 size_t offsetToRestore = reader->readInt(); |
| 145 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); | 145 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); |
| 146 canvas->clipRRect(rrect, regionOp, doAA); | 146 canvas->legacyClipRRect(rrect, regionOp, doAA); |
| 147 if (canvas->isClipEmpty() && offsetToRestore) { | 147 if (canvas->isClipEmpty() && offsetToRestore) { |
| 148 reader->setOffset(offsetToRestore); | 148 reader->setOffset(offsetToRestore); |
| 149 } | 149 } |
| 150 } break; | 150 } break; |
| 151 case PUSH_CULL: { | 151 case PUSH_CULL: { |
| 152 const SkRect& cullRect = reader->skipT<SkRect>(); | 152 const SkRect& cullRect = reader->skipT<SkRect>(); |
| 153 size_t offsetToRestore = reader->readInt(); | 153 size_t offsetToRestore = reader->readInt(); |
| 154 if (offsetToRestore && canvas->quickReject(cullRect)) { | 154 if (offsetToRestore && canvas->quickReject(cullRect)) { |
| 155 reader->setOffset(offsetToRestore); | 155 reader->setOffset(offsetToRestore); |
| 156 } else { | 156 } else { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 case TRANSLATE: { | 439 case TRANSLATE: { |
| 440 SkScalar dx = reader->readScalar(); | 440 SkScalar dx = reader->readScalar(); |
| 441 SkScalar dy = reader->readScalar(); | 441 SkScalar dy = reader->readScalar(); |
| 442 canvas->translate(dx, dy); | 442 canvas->translate(dx, dy); |
| 443 } break; | 443 } break; |
| 444 default: | 444 default: |
| 445 SkASSERTF(false, "Unknown draw type: %d", op); | 445 SkASSERTF(false, "Unknown draw type: %d", op); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 | 448 |
| OLD | NEW |