OLD | NEW |
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 Loading... |
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 | |
48 void SkRecorder::forgetRecord() { | 42 void SkRecorder::forgetRecord() { |
49 fDrawableList.reset(NULL); | 43 fDrawableList.reset(NULL); |
50 fRecord = NULL; | 44 fRecord = NULL; |
51 } | 45 } |
52 | 46 |
53 // To make appending to fRecord a little less verbose. | 47 // To make appending to fRecord a little less verbose. |
54 #define APPEND(T, ...) \ | 48 #define APPEND(T, ...) \ |
55 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V
A_ARGS__)) | 49 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V
A_ARGS__)) |
56 | 50 |
57 // For methods which must call back into SkCanvas. | 51 // For methods which must call back into SkCanvas. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 326 } |
333 | 327 |
334 void SkRecorder::addComment(const char* key, const char* value) { | 328 void SkRecorder::addComment(const char* key, const char* value) { |
335 APPEND(AddComment, this->copy(key), this->copy(value)); | 329 APPEND(AddComment, this->copy(key), this->copy(value)); |
336 } | 330 } |
337 | 331 |
338 void SkRecorder::endCommentGroup() { | 332 void SkRecorder::endCommentGroup() { |
339 APPEND(EndCommentGroup); | 333 APPEND(EndCommentGroup); |
340 } | 334 } |
341 | 335 |
OLD | NEW |