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/lib/ui/dart_wrapper.h"
9 #include "third_party/skia/include/core/SkPictureRecorder.h"
10 
11 namespace tonic {
12 class DartLibraryNatives;
13 } // namespace tonic
14 
15 namespace flutter {
16 class Canvas;
17 class Picture;
18 
19 class PictureRecorder : public RefCountedDartWrappable<PictureRecorder> {
22 
23  public:
24  static fml::RefPtr<PictureRecorder> Create();
25 
26  ~PictureRecorder() override;
27 
28  SkCanvas* BeginRecording(SkRect bounds);
29  fml::RefPtr<Picture> endRecording(Dart_Handle dart_picture);
30 
31  void set_canvas(fml::RefPtr<Canvas> canvas) { canvas_ = std::move(canvas); }
32 
33  static void RegisterNatives(tonic::DartLibraryNatives* natives);
34 
35  private:
37 
38  SkRTreeFactory rtree_factory_;
39  SkPictureRecorder picture_recorder_;
40  fml::RefPtr<Canvas> canvas_;
41 };
42 
43 } // namespace flutter
44 
45 #endif // FLUTTER_LIB_UI_PAINTING_PICTURE_RECORDER_H_
#define DEFINE_WRAPPERTYPEINFO()
#define FML_FRIEND_MAKE_REF_COUNTED(T)
Definition: ref_counted.h:131
void set_canvas(fml::RefPtr< Canvas > canvas)