Flutter Engine
picture_recorder.cc
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 #include "flutter/lib/ui/painting/picture_recorder.h"
6 
7 #include "flutter/lib/ui/painting/canvas.h"
8 #include "flutter/lib/ui/painting/picture.h"
13 
14 namespace flutter {
15 
16 static void PictureRecorder_constructor(Dart_NativeArguments args) {
19 }
20 
22 
23 #define FOR_EACH_BINDING(V) V(PictureRecorder, endRecording)
24 
26 
27 void PictureRecorder::RegisterNatives(tonic::DartLibraryNatives* natives) {
28  natives->Register(
29  {{"PictureRecorder_constructor", PictureRecorder_constructor, 1, true},
31 }
32 
34  return fml::MakeRefCounted<PictureRecorder>();
35 }
36 
37 PictureRecorder::PictureRecorder() {}
38 
40 
41 SkCanvas* PictureRecorder::BeginRecording(SkRect bounds) {
42  return picture_recorder_.beginRecording(bounds, &rtree_factory_);
43 }
44 
46  if (!canvas_) {
47  return nullptr;
48  }
49 
51  dart_picture, UIDartState::CreateGPUObject(
52  picture_recorder_.finishRecordingAsPicture()));
53 
54  canvas_->Invalidate();
55  canvas_ = nullptr;
57  return picture;
58 }
59 
60 } // namespace flutter
void DartCallConstructor(Sig func, Dart_NativeArguments args)
Definition: dart_args.h:218
SkCanvas * BeginRecording(SkRect bounds)
fml::RefPtr< Picture > endRecording(Dart_Handle dart_picture)
#define DART_NATIVE_CALLBACK(CLASS, METHOD)
#define FOR_EACH_BINDING(V)
static fml::RefPtr< Picture > Create(Dart_Handle dart_handle, flutter::SkiaGPUObject< SkPicture > picture)
Definition: picture.cc:31
IMPLEMENT_WRAPPERTYPEINFO(ui, Scene)
static void ThrowIfUIOperationsProhibited()
static void PictureRecorder_constructor(Dart_NativeArguments args)
#define DART_REGISTER_NATIVE(CLASS, METHOD)
static flutter::SkiaGPUObject< T > CreateGPUObject(sk_sp< T > object)
Definition: ui_dart_state.h:78
static fml::RefPtr< PictureRecorder > Create()