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

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

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