Chromium Code Reviews| 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 |
|
robertphillips
2014/11/18 20:51:53
Add one of these to SkRect?
reed1
2014/11/18 22:05:30
Love to, but I have to clean up SkRect.h first, wh
reed1
2014/11/19 14:49:16
Done.
| |
| 13 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h eight. | 13 static SkIRect round_out(const SkRect& r) { |
| 14 SkIRect ir; | |
| 15 r.roundOut(&ir); | |
| 16 return ir; | |
| 17 } | |
| 18 | |
| 14 SkRecorder::SkRecorder(SkRecord* record, int width, int height) | 19 SkRecorder::SkRecorder(SkRecord* record, int width, int height) |
| 15 : SkCanvas(width, height, SkCanvas::kConservativeRasterClip_InitFlag) | 20 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip _InitFlag) |
| 16 , fRecord(record) | 21 , fRecord(record) |
| 17 , fSaveLayerCount(0) {} | 22 , fSaveLayerCount(0) {} |
| 18 | 23 |
| 24 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) | |
| 25 : SkCanvas(round_out(bounds), SkCanvas::kConservativeRasterClip_InitFlag) | |
| 26 , fRecord(record) | |
| 27 , fSaveLayerCount(0) {} | |
| 28 | |
| 19 SkRecorder::~SkRecorder() { | 29 SkRecorder::~SkRecorder() { |
| 20 fDrawableList.unrefAll(); | 30 fDrawableList.unrefAll(); |
| 21 } | 31 } |
| 22 | 32 |
| 23 void SkRecorder::forgetRecord() { | 33 void SkRecorder::forgetRecord() { |
| 24 fDrawableList.unrefAll(); | 34 fDrawableList.unrefAll(); |
| 25 fDrawableList.reset(); | 35 fDrawableList.reset(); |
| 26 fRecord = NULL; | 36 fRecord = NULL; |
| 27 } | 37 } |
| 28 | 38 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 APPEND(EndCommentGroup); | 377 APPEND(EndCommentGroup); |
| 368 } | 378 } |
| 369 | 379 |
| 370 bool SkRecorder::isDrawingToLayer() const { | 380 bool SkRecorder::isDrawingToLayer() const { |
| 371 return fSaveLayerCount > 0; | 381 return fSaveLayerCount > 0; |
| 372 } | 382 } |
| 373 | 383 |
| 374 void SkRecorder::drawData(const void* data, size_t length) { | 384 void SkRecorder::drawData(const void* data, size_t length) { |
| 375 APPEND(DrawData, copy((const char*)data), length); | 385 APPEND(DrawData, copy((const char*)data), length); |
| 376 } | 386 } |
| OLD | NEW |