Flutter Engine
picture_recorder.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_LIB_UI_PAINTING_PICTURE_RECORDER_H_
6 #define FLUTTER_LIB_UI_PAINTING_PICTURE_RECORDER_H_
7 
8 #include "flutter/flow/display_list_canvas.h"
9 #include "flutter/lib/ui/dart_wrapper.h"
10 #include "third_party/skia/include/core/SkPictureRecorder.h"
11 
12 namespace tonic {
13 class DartLibraryNatives;
14 } // namespace tonic
15 
16 namespace flutter {
17 class Canvas;
18 class Picture;
19 
20 class PictureRecorder : public RefCountedDartWrappable<PictureRecorder> {
23 
24  public:
25  static fml::RefPtr<PictureRecorder> Create();
26 
27  ~PictureRecorder() override;
28 
29  SkCanvas* BeginRecording(SkRect bounds);
30  fml::RefPtr<Picture> endRecording(Dart_Handle dart_picture);
31 
32  sk_sp<DisplayListCanvasRecorder> display_list_recorder() {
33  return display_list_recorder_;
34  }
35 
36  void set_canvas(fml::RefPtr<Canvas> canvas) { canvas_ = std::move(canvas); }
37 
38  static void RegisterNatives(tonic::DartLibraryNatives* natives);
39 
40  private:
42 
43  SkRTreeFactory rtree_factory_;
44  SkPictureRecorder picture_recorder_;
45 
46  sk_sp<DisplayListCanvasRecorder> display_list_recorder_;
47 
48  fml::RefPtr<Canvas> canvas_;
49 };
50 
51 } // namespace flutter
52 
53 #endif // FLUTTER_LIB_UI_PAINTING_PICTURE_RECORDER_H_
#define DEFINE_WRAPPERTYPEINFO()
#define FML_FRIEND_MAKE_REF_COUNTED(T)
Definition: ref_counted.h:131
sk_sp< DisplayListCanvasRecorder > display_list_recorder()
void set_canvas(fml::RefPtr< Canvas > canvas)