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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 return NULL; | 78 return NULL; |
79 } | 79 } |
80 | 80 |
81 // Initialize the state tree iterator. Return false if there is nothing left to
draw. | 81 // Initialize the state tree iterator. Return false if there is nothing left to
draw. |
82 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter, | 82 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter, |
83 SkCanvas* canvas, | 83 SkCanvas* canvas, |
84 const SkPicture::OperationList *activeOpsLi
st) { | 84 const SkPicture::OperationList *activeOpsLi
st) { |
85 | 85 |
86 if (NULL != activeOpsList) { | 86 if (activeOpsList) { |
87 if (0 == activeOpsList->numOps()) { | 87 if (0 == activeOpsList->numOps()) { |
88 return false; // nothing to draw | 88 return false; // nothing to draw |
89 } | 89 } |
90 | 90 |
91 fPictureData->initIterator(iter, activeOpsList->fOps, canvas); | 91 fPictureData->initIterator(iter, activeOpsList->fOps, canvas); |
92 } | 92 } |
93 | 93 |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->s
ize()); | 143 SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->s
ize()); |
144 | 144 |
145 StepIterator(&it, &reader); | 145 StepIterator(&it, &reader); |
146 | 146 |
147 // Record this, so we can concat w/ it if we encounter a setMatrix() | 147 // Record this, so we can concat w/ it if we encounter a setMatrix() |
148 SkMatrix initialMatrix = canvas->getTotalMatrix(); | 148 SkMatrix initialMatrix = canvas->getTotalMatrix(); |
149 | 149 |
150 SkAutoCanvasRestore acr(canvas, false); | 150 SkAutoCanvasRestore acr(canvas, false); |
151 | 151 |
152 while (!reader.eof()) { | 152 while (!reader.eof()) { |
153 if (NULL != callback && callback->abortDrawing()) { | 153 if (callback && callback->abortDrawing()) { |
154 return; | 154 return; |
155 } | 155 } |
156 | 156 |
157 fCurOffset = reader.offset(); | 157 fCurOffset = reader.offset(); |
158 uint32_t size; | 158 uint32_t size; |
159 DrawType op = ReadOpAndSize(&reader, &size); | 159 DrawType op = ReadOpAndSize(&reader, &size); |
160 if (NOOP == op) { | 160 if (NOOP == op) { |
161 // NOOPs are to be ignored - do not propagate them any further | 161 // NOOPs are to be ignored - do not propagate them any further |
162 SkipIterTo(&it, &reader, fCurOffset + size); | 162 SkipIterTo(&it, &reader, fCurOffset + size); |
163 continue; | 163 continue; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 case TRANSLATE: { | 515 case TRANSLATE: { |
516 SkScalar dx = reader->readScalar(); | 516 SkScalar dx = reader->readScalar(); |
517 SkScalar dy = reader->readScalar(); | 517 SkScalar dy = reader->readScalar(); |
518 canvas->translate(dx, dy); | 518 canvas->translate(dx, dy); |
519 } break; | 519 } break; |
520 default: | 520 default: |
521 SkASSERT(0); | 521 SkASSERT(0); |
522 } | 522 } |
523 } | 523 } |
524 | 524 |
OLD | NEW |