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 #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 Loading... |
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_ |
OLD | NEW |