| 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" |
| 11 #include "base/optional.h" | 11 #include "base/optional.h" |
| 12 #include "cc/paint/paint_canvas.h" | 12 #include "cc/paint/paint_canvas.h" |
| 13 #include "cc/paint/paint_record.h" | 13 #include "cc/paint/paint_record.h" |
| 14 #include "cc/paint/skia_paint_canvas.h" |
| 14 #include "third_party/skia/include/core/SkPictureRecorder.h" | 15 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 | 18 |
| 18 class CC_PAINT_EXPORT PaintRecorder { | 19 class CC_PAINT_EXPORT PaintRecorder { |
| 19 public: | 20 public: |
| 20 PaintRecorder(); | 21 PaintRecorder(); |
| 21 ~PaintRecorder(); | 22 ~PaintRecorder(); |
| 22 | 23 |
| 23 ALWAYS_INLINE PaintCanvas* beginRecording(const SkRect& bounds) { | 24 ALWAYS_INLINE PaintCanvas* beginRecording(const SkRect& bounds) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 const SkRect& cull_rect, | 55 const SkRect& cull_rect, |
| 55 uint32_t end_flags = 0) { | 56 uint32_t end_flags = 0) { |
| 56 sk_sp<SkPicture> picture = | 57 sk_sp<SkPicture> picture = |
| 57 recorder_.finishRecordingAsPictureWithCull(cull_rect, end_flags); | 58 recorder_.finishRecordingAsPictureWithCull(cull_rect, end_flags); |
| 58 canvas_.reset(); | 59 canvas_.reset(); |
| 59 return sk_ref_sp(static_cast<PaintRecord*>(picture.get())); | 60 return sk_ref_sp(static_cast<PaintRecord*>(picture.get())); |
| 60 } | 61 } |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 SkPictureRecorder recorder_; | 64 SkPictureRecorder recorder_; |
| 64 base::Optional<PaintCanvas> canvas_; | 65 base::Optional<SkiaPaintCanvas> canvas_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); | 67 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace cc | 70 } // namespace cc |
| 70 | 71 |
| 71 #endif // CC_PAINT_PAINT_RECORDER_H_ | 72 #endif // CC_PAINT_PAINT_RECORDER_H_ |
| OLD | NEW |