Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: cc/paint/paint_recorder.cc

Issue 2820133005: Revert of Back PaintRecord with PaintOpBuffer instead of SkPicture (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/paint/paint_recorder.h ('k') | cc/paint/record_paint_canvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
9 namespace cc { 7 namespace cc {
10 8
11 PaintRecorder::PaintRecorder() = default; 9 PaintRecorder::PaintRecorder() = default;
12
13 PaintRecorder::~PaintRecorder() = default; 10 PaintRecorder::~PaintRecorder() = default;
14 11
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 // SkPictureRecorder users expect that their saves are automatically
23 // closed for them.
24 //
25 // NOTE: Blink paint in general doesn't appear to need this, but the
26 // RecordingImageBufferSurface::fallBackToRasterCanvas finishing off the
27 // current frame depends on this. Maybe we could remove this assumption and
28 // just have callers do it.
29 canvas_->restoreToCount(1);
30
31 // Some users (e.g. printing) use the existence of the recording canvas
32 // to know if recording is finished, so reset it here.
33 canvas_.reset();
34
35 buffer_->ShrinkToFit();
36 return std::move(buffer_);
37 }
38
39 } // namespace cc 12 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/paint_recorder.h ('k') | cc/paint/record_paint_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698