Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: src/core/SkPicturePlayback.cpp

Issue 375943002: Fixed up SkTimedPicturePlayback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRangePlayback.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkPicturePlayback.h" 10 #include "SkPicturePlayback.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return; 145 return;
146 } 146 }
147 reader.setOffset(skipTo); 147 reader.setOffset(skipTo);
148 } 148 }
149 149
150 // Record this, so we can concat w/ it if we encounter a setMatrix() 150 // Record this, so we can concat w/ it if we encounter a setMatrix()
151 SkMatrix initialMatrix = canvas->getTotalMatrix(); 151 SkMatrix initialMatrix = canvas->getTotalMatrix();
152 152
153 SkAutoCanvasRestore acr(canvas, false); 153 SkAutoCanvasRestore acr(canvas, false);
154 154
155 #ifdef SK_DEVELOPER
156 int opIndex = -1;
157 #endif
158
159 while (!reader.eof()) { 155 while (!reader.eof()) {
160 if (callback && callback->abortDrawing()) { 156 if (callback && callback->abortDrawing()) {
161 return; 157 return;
162 } 158 }
163 159
164 if (NULL != fReplacements) { 160 if (NULL != fReplacements) {
165 // Potentially replace a block of operations with a single drawBitma p call 161 // Potentially replace a block of operations with a single drawBitma p call
166 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp = 162 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp =
167 fReplacements->lookupByStart(reader.offset()); 163 fReplacements->lookupByStart(reader.offset());
168 if (NULL != temp) { 164 if (NULL != temp) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 221 }
226 } 222 }
227 223
228 fCurOffset = reader.offset(); 224 fCurOffset = reader.offset();
229 uint32_t size; 225 uint32_t size;
230 DrawType op = ReadOpAndSize(&reader, &size); 226 DrawType op = ReadOpAndSize(&reader, &size);
231 size_t skipTo = 0; 227 size_t skipTo = 0;
232 if (NOOP == op) { 228 if (NOOP == op) {
233 // NOOPs are to be ignored - do not propagate them any further 229 // NOOPs are to be ignored - do not propagate them any further
234 skipTo = fCurOffset + size; 230 skipTo = fCurOffset + size;
235 #ifdef SK_DEVELOPER
236 } else {
237 opIndex++;
238 if (this->preDraw(opIndex, op)) {
239 skipTo = fCurOffset + size;
240 }
241 #endif
242 } 231 }
243 232
244 if (0 != skipTo) { 233 if (0 != skipTo) {
245 if (it.isValid()) { 234 if (it.isValid()) {
246 // If using a bounding box hierarchy, advance the state tree 235 // If using a bounding box hierarchy, advance the state tree
247 // iterator until at or after skipTo 236 // iterator until at or after skipTo
248 uint32_t adjustedSkipTo; 237 uint32_t adjustedSkipTo;
249 do { 238 do {
250 adjustedSkipTo = it.nextDraw(); 239 adjustedSkipTo = it.nextDraw();
251 } while (adjustedSkipTo < skipTo); 240 } while (adjustedSkipTo < skipTo);
252 skipTo = adjustedSkipTo; 241 skipTo = adjustedSkipTo;
253 } 242 }
254 if (kDrawComplete == skipTo) { 243 if (kDrawComplete == skipTo) {
255 break; 244 break;
256 } 245 }
257 reader.setOffset(skipTo); 246 reader.setOffset(skipTo);
258 continue; 247 continue;
259 } 248 }
260 249
261 this->handleOp(&reader, op, size, canvas, initialMatrix); 250 this->handleOp(&reader, op, size, canvas, initialMatrix);
262 251
263 #ifdef SK_DEVELOPER
264 this->postDraw(opIndex);
265 #endif
266
267 if (it.isValid()) { 252 if (it.isValid()) {
268 uint32_t skipTo = it.nextDraw(); 253 uint32_t skipTo = it.nextDraw();
269 if (kDrawComplete == skipTo) { 254 if (kDrawComplete == skipTo) {
270 break; 255 break;
271 } 256 }
272 reader.setOffset(skipTo); 257 reader.setOffset(skipTo);
273 } 258 }
274 } 259 }
275 } 260 }
276 261
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 case TRANSLATE: { 566 case TRANSLATE: {
582 SkScalar dx = reader->readScalar(); 567 SkScalar dx = reader->readScalar();
583 SkScalar dy = reader->readScalar(); 568 SkScalar dy = reader->readScalar();
584 canvas->translate(dx, dy); 569 canvas->translate(dx, dy);
585 } break; 570 } break;
586 default: 571 default:
587 SkASSERT(0); 572 SkASSERT(0);
588 } 573 }
589 } 574 }
590 575
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRangePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698