Flutter Engine
 
Loading...
Searching...
No Matches
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
6
13
14namespace flutter {
15
17
18void PictureRecorder::Create(Dart_Handle wrapper) {
20 auto res = fml::MakeRefCounted<PictureRecorder>();
21 res->AssociateWithDartWrapper(wrapper);
22}
23
24PictureRecorder::PictureRecorder() {}
25
27
28sk_sp<DisplayListBuilder> PictureRecorder::BeginRecording(DlRect bounds) {
29 display_list_builder_ =
30 sk_make_sp<DisplayListBuilder>(bounds, /*prepare_rtree=*/true);
31 return display_list_builder_;
32}
33
34void PictureRecorder::endRecording(Dart_Handle dart_picture) {
35 if (!canvas_) {
36 return;
37 }
38
39 auto display_list = display_list_builder_->Build();
40 display_list_builder_ = nullptr;
41
42 FML_DCHECK(display_list->has_rtree());
43 Picture::CreateAndAssociateWithDartWrapper(dart_picture, display_list);
44
45 canvas_->Invalidate();
46 canvas_ = nullptr;
48}
49
50} // namespace flutter
static void CreateAndAssociateWithDartWrapper(Dart_Handle dart_handle, sk_sp< DisplayList > display_list)
Definition picture.cc:29
static void Create(Dart_Handle wrapper)
void endRecording(Dart_Handle dart_picture)
sk_sp< DisplayListBuilder > BeginRecording(DlRect bounds)
static void ThrowIfUIOperationsProhibited()
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
#define FML_DCHECK(condition)
Definition logging.h:122