| 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. | |
| 14 SkRecorder::SkRecorder(SkRecord* record, int width, int height) | 13 SkRecorder::SkRecorder(SkRecord* record, int width, int height) |
| 15 : SkCanvas(width, height, SkCanvas::kConservativeRasterClip_InitFlag) | 14 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip
_InitFlag) |
| 16 , fRecord(record) | 15 , fRecord(record) |
| 17 , fSaveLayerCount(0) {} | 16 , fSaveLayerCount(0) {} |
| 18 | 17 |
| 18 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) |
| 19 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag) |
| 20 , fRecord(record) |
| 21 , fSaveLayerCount(0) {} |
| 22 |
| 19 SkRecorder::~SkRecorder() { | 23 SkRecorder::~SkRecorder() { |
| 20 fDrawableList.unrefAll(); | 24 fDrawableList.unrefAll(); |
| 21 } | 25 } |
| 22 | 26 |
| 23 void SkRecorder::forgetRecord() { | 27 void SkRecorder::forgetRecord() { |
| 24 fDrawableList.unrefAll(); | 28 fDrawableList.unrefAll(); |
| 25 fDrawableList.reset(); | 29 fDrawableList.reset(); |
| 26 fRecord = NULL; | 30 fRecord = NULL; |
| 27 } | 31 } |
| 28 | 32 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 APPEND(EndCommentGroup); | 371 APPEND(EndCommentGroup); |
| 368 } | 372 } |
| 369 | 373 |
| 370 bool SkRecorder::isDrawingToLayer() const { | 374 bool SkRecorder::isDrawingToLayer() const { |
| 371 return fSaveLayerCount > 0; | 375 return fSaveLayerCount > 0; |
| 372 } | 376 } |
| 373 | 377 |
| 374 void SkRecorder::drawData(const void* data, size_t length) { | 378 void SkRecorder::drawData(const void* data, size_t length) { |
| 375 APPEND(DrawData, copy((const char*)data), length); | 379 APPEND(DrawData, copy((const char*)data), length); |
| 376 } | 380 } |
| OLD | NEW |