Flutter Engine
The 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
14namespace flutter {
15
17
20 auto res = fml::MakeRefCounted<PictureRecorder>();
21 res->AssociateWithDartWrapper(wrapper);
22}
23
24PictureRecorder::PictureRecorder() {}
25
27
29 display_list_builder_ =
30 sk_make_sp<DisplayListBuilder>(bounds, /*prepare_rtree=*/true);
31 return display_list_builder_;
32}
33
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 Create(Dart_Handle wrapper)
sk_sp< DisplayListBuilder > BeginRecording(SkRect bounds)
void endRecording(Dart_Handle dart_picture)
static void CreateAndAssociateWithDartWrapper(Dart_Handle dart_handle, sk_sp< DisplayList > display_list)
Definition: picture.cc:29
static void ThrowIfUIOperationsProhibited()
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
#define FML_DCHECK(condition)
Definition: logging.h:103
Optional< SkRect > bounds
Definition: SkRecords.h:189
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, FlutterGpuTestClass)