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 "SkPictureData.h" | 9 #include "SkPictureData.h" |
10 #include "SkPictureRangePlayback.h" | 10 #include "SkPictureRangePlayback.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 SkASSERT(SAVE_LAYER == op); | 22 SkASSERT(SAVE_LAYER == op); |
23 reader.setOffset(fStart + size); | 23 reader.setOffset(fStart + size); |
24 } | 24 } |
25 | 25 |
26 // Record this, so we can concat w/ it if we encounter a setMatrix() | 26 // Record this, so we can concat w/ it if we encounter a setMatrix() |
27 SkMatrix initialMatrix = canvas->getTotalMatrix(); | 27 SkMatrix initialMatrix = canvas->getTotalMatrix(); |
28 | 28 |
29 SkAutoCanvasRestore acr(canvas, false); | 29 SkAutoCanvasRestore acr(canvas, false); |
30 | 30 |
31 while (!reader.eof()) { | 31 while (!reader.eof()) { |
32 if (callback && callback->abortDrawing()) { | 32 if (NULL != callback && callback->abortDrawing()) { |
33 return; | 33 return; |
34 } | 34 } |
35 | 35 |
36 if (0 != fStart || 0 != fStop) { | 36 if (0 != fStart || 0 != fStop) { |
37 size_t offset = reader.offset(); | 37 size_t offset = reader.offset(); |
38 if (offset >= fStop) { | 38 if (offset >= fStop) { |
39 SkDEBUGCODE(uint32_t size;) | 39 SkDEBUGCODE(uint32_t size;) |
40 SkDEBUGCODE(DrawType op = ReadOpAndSize(&reader, &size);) | 40 SkDEBUGCODE(DrawType op = ReadOpAndSize(&reader, &size);) |
41 SkASSERT(RESTORE == op); | 41 SkASSERT(RESTORE == op); |
42 return; | 42 return; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 fCurOffset = reader.offset(); | 46 fCurOffset = reader.offset(); |
47 uint32_t size; | 47 uint32_t size; |
48 DrawType op = ReadOpAndSize(&reader, &size); | 48 DrawType op = ReadOpAndSize(&reader, &size); |
49 if (NOOP == op) { | 49 if (NOOP == op) { |
50 // NOOPs are to be ignored - do not propagate them any further | 50 // NOOPs are to be ignored - do not propagate them any further |
51 reader.setOffset(fCurOffset + size); | 51 reader.setOffset(fCurOffset + size); |
52 continue; | 52 continue; |
53 } | 53 } |
54 | 54 |
55 this->handleOp(&reader, op, size, canvas, initialMatrix); | 55 this->handleOp(&reader, op, size, canvas, initialMatrix); |
56 } | 56 } |
57 } | 57 } |
OLD | NEW |