| 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 "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkRecorder.h" | 9 #include "SkRecorder.h" |
| 10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
| 11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
| 12 | 12 |
| 13 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h
eight. |
| 13 SkRecorder::SkRecorder(SkRecord* record, int width, int height) | 14 SkRecorder::SkRecorder(SkRecord* record, int width, int height) |
| 14 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip
_InitFlag) | 15 : SkCanvas(width, height, SkCanvas::kConservativeRasterClip_InitFlag) |
| 15 , fRecord(record) | 16 , fRecord(record) |
| 16 , fSaveLayerCount(0) {} | 17 , fSaveLayerCount(0) {} |
| 17 | 18 |
| 18 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) | |
| 19 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag) | |
| 20 , fRecord(record) | |
| 21 , fSaveLayerCount(0) {} | |
| 22 | |
| 23 SkRecorder::~SkRecorder() { | 19 SkRecorder::~SkRecorder() { |
| 24 fDrawableList.unrefAll(); | 20 fDrawableList.unrefAll(); |
| 25 } | 21 } |
| 26 | 22 |
| 27 void SkRecorder::forgetRecord() { | 23 void SkRecorder::forgetRecord() { |
| 28 fDrawableList.unrefAll(); | 24 fDrawableList.unrefAll(); |
| 29 fDrawableList.reset(); | 25 fDrawableList.reset(); |
| 30 fRecord = NULL; | 26 fRecord = NULL; |
| 31 } | 27 } |
| 32 | 28 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 APPEND(EndCommentGroup); | 367 APPEND(EndCommentGroup); |
| 372 } | 368 } |
| 373 | 369 |
| 374 bool SkRecorder::isDrawingToLayer() const { | 370 bool SkRecorder::isDrawingToLayer() const { |
| 375 return fSaveLayerCount > 0; | 371 return fSaveLayerCount > 0; |
| 376 } | 372 } |
| 377 | 373 |
| 378 void SkRecorder::drawData(const void* data, size_t length) { | 374 void SkRecorder::drawData(const void* data, size_t length) { |
| 379 APPEND(DrawData, copy((const char*)data), length); | 375 APPEND(DrawData, copy((const char*)data), length); |
| 380 } | 376 } |
| OLD | NEW |