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

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

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all Created 3 years, 7 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_record.cc ('k') | cc/paint/paint_shader.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" 7 #include "cc/paint/paint_op_buffer.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 PaintRecorder::PaintRecorder() = default; 11 PaintRecorder::PaintRecorder() = default;
12 12
13 PaintRecorder::~PaintRecorder() = default; 13 PaintRecorder::~PaintRecorder() = default;
14 14
15 PaintCanvas* PaintRecorder::beginRecording(const SkRect& bounds) { 15 PaintCanvas* PaintRecorder::beginRecording(const SkRect& bounds) {
16 buffer_.reset(new PaintOpBuffer(bounds)); 16 buffer_ = sk_make_sp<PaintOpBuffer>();
17 canvas_.emplace(buffer_.get()); 17 canvas_.emplace(buffer_.get(), bounds);
18 return getRecordingCanvas(); 18 return getRecordingCanvas();
19 } 19 }
20 20
21 sk_sp<PaintRecord> PaintRecorder::finishRecordingAsPicture() { 21 sk_sp<PaintRecord> PaintRecorder::finishRecordingAsPicture() {
22 // SkPictureRecorder users expect that their saves are automatically 22 // SkPictureRecorder users expect that their saves are automatically
23 // closed for them. 23 // closed for them.
24 // 24 //
25 // NOTE: Blink paint in general doesn't appear to need this, but the 25 // NOTE: Blink paint in general doesn't appear to need this, but the
26 // RecordingImageBufferSurface::fallBackToRasterCanvas finishing off the 26 // RecordingImageBufferSurface::fallBackToRasterCanvas finishing off the
27 // current frame depends on this. Maybe we could remove this assumption and 27 // current frame depends on this. Maybe we could remove this assumption and
28 // just have callers do it. 28 // just have callers do it.
29 canvas_->restoreToCount(1); 29 canvas_->restoreToCount(1);
30 30
31 // Some users (e.g. printing) use the existence of the recording canvas 31 // Some users (e.g. printing) use the existence of the recording canvas
32 // to know if recording is finished, so reset it here. 32 // to know if recording is finished, so reset it here.
33 canvas_.reset(); 33 canvas_.reset();
34 34
35 buffer_->ShrinkToFit(); 35 buffer_->ShrinkToFit();
36 return std::move(buffer_); 36 return std::move(buffer_);
37 } 37 }
38 38
39 } // namespace cc 39 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/paint_record.cc ('k') | cc/paint/paint_shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698