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

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

Issue 837693002: Rename SkDrawPictureCallback to SkAbortCallback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 11 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/SkRecordDraw.h » ('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 "SkAbortCallback.h"
8 #include "SkCanvas.h" 9 #include "SkCanvas.h"
9 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
10 #include "SkPictureData.h" 11 #include "SkPictureData.h"
11 #include "SkPicturePlayback.h" 12 #include "SkPicturePlayback.h"
12 #include "SkPictureRecord.h" 13 #include "SkPictureRecord.h"
13 #include "SkReader32.h" 14 #include "SkReader32.h"
14 #include "SkTextBlob.h" 15 #include "SkTextBlob.h"
15 #include "SkTDArray.h" 16 #include "SkTDArray.h"
16 #include "SkTypes.h" 17 #include "SkTypes.h"
17 18
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void get_text(SkReader32* reader, TextContainer* text) { 59 void get_text(SkReader32* reader, TextContainer* text) {
59 size_t length = text->fByteLength = reader->readInt(); 60 size_t length = text->fByteLength = reader->readInt();
60 text->fText = (const char*)reader->skip(length); 61 text->fText = (const char*)reader->skip(length);
61 } 62 }
62 63
63 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads. 64 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads.
64 static SkBitmap shallow_copy(const SkBitmap& bitmap) { 65 static SkBitmap shallow_copy(const SkBitmap& bitmap) {
65 return bitmap; 66 return bitmap;
66 } 67 }
67 68
68 void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) { 69 void SkPicturePlayback::draw(SkCanvas* canvas, SkAbortCallback* callback) {
69 AutoResetOpID aroi(this); 70 AutoResetOpID aroi(this);
70 SkASSERT(0 == fCurOffset); 71 SkASSERT(0 == fCurOffset);
71 72
72 SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->s ize()); 73 SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->s ize());
73 74
74 // Record this, so we can concat w/ it if we encounter a setMatrix() 75 // Record this, so we can concat w/ it if we encounter a setMatrix()
75 SkMatrix initialMatrix = canvas->getTotalMatrix(); 76 SkMatrix initialMatrix = canvas->getTotalMatrix();
76 77
77 SkAutoCanvasRestore acr(canvas, false); 78 SkAutoCanvasRestore acr(canvas, false);
78 79
79 while (!reader.eof()) { 80 while (!reader.eof()) {
80 if (callback && callback->abortDrawing()) { 81 if (callback && callback->abort()) {
81 return; 82 return;
82 } 83 }
83 84
84 fCurOffset = reader.offset(); 85 fCurOffset = reader.offset();
85 uint32_t size; 86 uint32_t size;
86 DrawType op = ReadOpAndSize(&reader, &size); 87 DrawType op = ReadOpAndSize(&reader, &size);
87 88
88 this->handleOp(&reader, op, size, canvas, initialMatrix); 89 this->handleOp(&reader, op, size, canvas, initialMatrix);
89 } 90 }
90 } 91 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 case TRANSLATE: { 434 case TRANSLATE: {
434 SkScalar dx = reader->readScalar(); 435 SkScalar dx = reader->readScalar();
435 SkScalar dy = reader->readScalar(); 436 SkScalar dy = reader->readScalar();
436 canvas->translate(dx, dy); 437 canvas->translate(dx, dy);
437 } break; 438 } break;
438 default: 439 default:
439 SkASSERTF(false, "Unknown draw type: %d", op); 440 SkASSERTF(false, "Unknown draw type: %d", op);
440 } 441 }
441 } 442 }
442 443
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkRecordDraw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698