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

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

Issue 1067893002: SkCanvas::resetForNextPicture() (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Return null when we're not recording. Should fix printing failures. Created 5 years, 8 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/SkRecorder.h ('k') | tests/PictureTest.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 "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 21 matching lines...) Expand all
32 //////////////////////////////////////////////////////////////////////////////// /////////////// 32 //////////////////////////////////////////////////////////////////////////////// ///////////////
33 33
34 SkRecorder::SkRecorder(SkRecord* record, int width, int height) 34 SkRecorder::SkRecorder(SkRecord* record, int width, int height)
35 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip _InitFlag) 35 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip _InitFlag)
36 , fRecord(record) {} 36 , fRecord(record) {}
37 37
38 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) 38 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds)
39 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag) 39 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
40 , fRecord(record) {} 40 , fRecord(record) {}
41 41
42 void SkRecorder::reset(SkRecord* record, const SkRect& bounds) {
43 this->forgetRecord();
44 fRecord = record;
45 this->resetForNextPicture(bounds.roundOut());
46 }
47
42 void SkRecorder::forgetRecord() { 48 void SkRecorder::forgetRecord() {
43 fDrawableList.reset(NULL); 49 fDrawableList.reset(NULL);
44 fRecord = NULL; 50 fRecord = NULL;
45 } 51 }
46 52
47 // To make appending to fRecord a little less verbose. 53 // To make appending to fRecord a little less verbose.
48 #define APPEND(T, ...) \ 54 #define APPEND(T, ...) \
49 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__)) 55 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__))
50 56
51 // For methods which must call back into SkCanvas. 57 // For methods which must call back into SkCanvas.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 332 }
327 333
328 void SkRecorder::addComment(const char* key, const char* value) { 334 void SkRecorder::addComment(const char* key, const char* value) {
329 APPEND(AddComment, this->copy(key), this->copy(value)); 335 APPEND(AddComment, this->copy(key), this->copy(value));
330 } 336 }
331 337
332 void SkRecorder::endCommentGroup() { 338 void SkRecorder::endCommentGroup() {
333 APPEND(EndCommentGroup); 339 APPEND(EndCommentGroup);
334 } 340 }
335 341
OLDNEW
« no previous file with comments | « src/core/SkRecorder.h ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698