OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/paint/paint_recorder.h" | 5 #include "cc/paint/paint_recorder.h" |
6 | 6 |
7 #include "cc/paint/paint_op_buffer.h" | |
8 | |
7 namespace cc { | 9 namespace cc { |
8 | 10 |
9 PaintRecorder::PaintRecorder() = default; | 11 PaintRecorder::PaintRecorder() = default; |
12 | |
10 PaintRecorder::~PaintRecorder() = default; | 13 PaintRecorder::~PaintRecorder() = default; |
11 | 14 |
15 PaintCanvas* PaintRecorder::beginRecording(const SkRect& bounds) { | |
16 buffer_.reset(new PaintOpBuffer(bounds)); | |
17 canvas_.emplace(buffer_.get(), bounds); | |
18 return getRecordingCanvas(); | |
19 } | |
20 | |
21 sk_sp<PaintRecord> PaintRecorder::finishRecordingAsPicture() { | |
22 // Some users (e.g. printing) use the existence of the recording canvas | |
23 // to know if recording is finished, so reset it here. | |
24 canvas_.reset(); | |
25 // TODO(enne): consider making a mini picture here. | |
vmpstr
2017/03/28 18:27:15
Do we still need this with the optimization in the
enne (OOO)
2017/03/28 19:28:05
Yeah, it's possible. I think I would consider mak
| |
26 return std::move(buffer_); | |
27 } | |
28 | |
12 } // namespace cc | 29 } // namespace cc |
OLD | NEW |