| 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 |
| 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 Loading... |
| 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 |
| OLD | NEW |