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

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

Issue 374833006: Split SkPictureRangePlayback out of SkPicturePlayback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Addressed code review comments 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/SkPictureRangePlayback.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkCanvas.h"
9 #include "SkPictureData.h"
10 #include "SkPictureRangePlayback.h"
11
12 void SkPictureRangePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callb ack) {
13 AutoResetOpID aroi(this);
14 SkASSERT(0 == fCurOffset);
15
16 SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->s ize());
17
18 if (0 != fStart || 0 != fStop) {
19 reader.setOffset(fStart);
20 uint32_t size;
21 SkDEBUGCODE(DrawType op = ) ReadOpAndSize(&reader, &size);
22 SkASSERT(SAVE_LAYER == op);
23 reader.setOffset(fStart + size);
24 }
25
26 // Record this, so we can concat w/ it if we encounter a setMatrix()
27 SkMatrix initialMatrix = canvas->getTotalMatrix();
28
29 SkAutoCanvasRestore acr(canvas, false);
30
31 while (!reader.eof()) {
32 if (callback && callback->abortDrawing()) {
33 return;
34 }
35
36 if (0 != fStart || 0 != fStop) {
37 size_t offset = reader.offset();
38 if (offset >= fStop) {
39 SkDEBUGCODE(uint32_t size;)
40 SkDEBUGCODE(DrawType op = ReadOpAndSize(&reader, &size);)
41 SkASSERT(RESTORE == op);
42 return;
43 }
44 }
45
46 fCurOffset = reader.offset();
47 uint32_t size;
48 DrawType op = ReadOpAndSize(&reader, &size);
49 if (NOOP == op) {
50 // NOOPs are to be ignored - do not propagate them any further
51 reader.setOffset(fCurOffset + size);
52 continue;
53 }
54
55 this->handleOp(&reader, op, size, canvas, initialMatrix);
56 }
57 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRangePlayback.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698