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

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

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 Created 3 years, 9 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_canvas.h ('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 #ifndef CC_PAINT_PAINT_RECORDER_H_ 5 #ifndef CC_PAINT_PAINT_RECORDER_H_
6 #define CC_PAINT_PAINT_RECORDER_H_ 6 #define CC_PAINT_PAINT_RECORDER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 ALWAYS_INLINE sk_sp<PaintRecord> finishRecordingAsPicture( 45 ALWAYS_INLINE sk_sp<PaintRecord> finishRecordingAsPicture(
46 uint32_t end_flags = 0) { 46 uint32_t end_flags = 0) {
47 sk_sp<SkPicture> picture = recorder_.finishRecordingAsPicture(end_flags); 47 sk_sp<SkPicture> picture = recorder_.finishRecordingAsPicture(end_flags);
48 // Some users (e.g. printing) use the existence of the recording canvas 48 // Some users (e.g. printing) use the existence of the recording canvas
49 // to know if recording is finished, so reset it here. 49 // to know if recording is finished, so reset it here.
50 canvas_.reset(); 50 canvas_.reset();
51 return sk_ref_sp(static_cast<PaintRecord*>(picture.get())); 51 return sk_ref_sp(static_cast<PaintRecord*>(picture.get()));
52 } 52 }
53 53
54 ALWAYS_INLINE sk_sp<PaintRecord> finishRecordingAsPictureWithCull(
55 const SkRect& cull_rect,
56 uint32_t end_flags = 0) {
57 sk_sp<SkPicture> picture =
58 recorder_.finishRecordingAsPictureWithCull(cull_rect, end_flags);
59 canvas_.reset();
60 return sk_ref_sp(static_cast<PaintRecord*>(picture.get()));
61 }
62
63 private: 54 private:
64 SkPictureRecorder recorder_; 55 SkPictureRecorder recorder_;
65 base::Optional<SkiaPaintCanvas> canvas_; 56 base::Optional<SkiaPaintCanvas> canvas_;
66 57
67 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); 58 DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
68 }; 59 };
69 60
70 } // namespace cc 61 } // namespace cc
71 62
72 #endif // CC_PAINT_PAINT_RECORDER_H_ 63 #endif // CC_PAINT_PAINT_RECORDER_H_
OLDNEW
« no previous file with comments | « cc/paint/paint_canvas.h ('k') | cc/paint/paint_shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698