Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
flutter::SurfaceFrame Class Reference

#include <surface_frame.h>

Classes

struct  FramebufferInfo
 
struct  SubmitInfo
 

Public Types

using SubmitCallback = std::function< bool(SurfaceFrame &surface_frame, DlCanvas *canvas)>
 

Public Member Functions

 SurfaceFrame (sk_sp< SkSurface > surface, FramebufferInfo framebuffer_info, const SubmitCallback &submit_callback, SkISize frame_size, std::unique_ptr< GLContextResult > context_result=nullptr, bool display_list_fallback=false)
 
bool Submit ()
 
bool IsSubmitted () const
 
sk_sp< SkSurfaceSkiaSurface () const
 
DlCanvasCanvas ()
 
const FramebufferInfoframebuffer_info () const
 
void set_submit_info (const SubmitInfo &submit_info)
 
const SubmitInfosubmit_info () const
 
sk_sp< DisplayListBuildDisplayList ()
 

Detailed Description

Definition at line 24 of file surface_frame.h.

Member Typedef Documentation

◆ SubmitCallback

Definition at line 26 of file surface_frame.h.

Constructor & Destructor Documentation

◆ SurfaceFrame()

flutter::SurfaceFrame::SurfaceFrame ( sk_sp< SkSurface surface,
FramebufferInfo  framebuffer_info,
const SubmitCallback submit_callback,
SkISize  frame_size,
std::unique_ptr< GLContextResult context_result = nullptr,
bool  display_list_fallback = false 
)

Definition at line 18 of file surface_frame.cc.

24 : surface_(std::move(surface)),
25 framebuffer_info_(framebuffer_info),
26 submit_callback_(submit_callback),
27 context_result_(std::move(context_result)) {
28 FML_DCHECK(submit_callback_);
29 if (surface_) {
30#if !SLIMPELLER
31 adapter_.set_canvas(surface_->getCanvas());
32 canvas_ = &adapter_;
33#else // !SLIMPELLER
34 FML_LOG(FATAL) << "Impeller opt-out unavailable.";
35 return;
36#endif // !SLIMPELLER
37 } else if (display_list_fallback) {
38 FML_DCHECK(!frame_size.isEmpty());
39 // The root frame of a surface will be filled by the layer_tree which
40 // performs branch culling so it will be unlikely to need an rtree for
41 // further culling during `DisplayList::Dispatch`. Further, this canvas
42 // will live underneath any platform views so we do not need to compute
43 // exact coverage to describe "pixel ownership" to the platform.
44 dl_builder_ = sk_make_sp<DisplayListBuilder>(SkRect::Make(frame_size),
45 /*prepare_rtree=*/false);
46 canvas_ = dl_builder_.get();
47 }
48}
SkCanvas * getCanvas()
Definition: SkSurface.cpp:82
void set_canvas(SkCanvas *canvas)
Definition: dl_sk_canvas.cc:39
const FramebufferInfo & framebuffer_info() const
Definition: surface_frame.h:93
VkSurfaceKHR surface
Definition: main.cc:49
#define FATAL(error)
#define FML_LOG(severity)
Definition: logging.h:82
#define FML_DCHECK(condition)
Definition: logging.h:103
bool isEmpty() const
Definition: SkSize.h:31
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

Member Function Documentation

◆ BuildDisplayList()

sk_sp< DisplayList > flutter::SurfaceFrame::BuildDisplayList ( )

Definition at line 85 of file surface_frame.cc.

85 {
86 TRACE_EVENT0("impeller", "SurfaceFrame::BuildDisplayList");
87 return dl_builder_ ? dl_builder_->Build() : nullptr;
88}
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131

◆ Canvas()

DlCanvas * flutter::SurfaceFrame::Canvas ( )

Definition at line 65 of file surface_frame.cc.

65 {
66 return canvas_;
67}

◆ framebuffer_info()

const FramebufferInfo & flutter::SurfaceFrame::framebuffer_info ( ) const
inline

Definition at line 93 of file surface_frame.h.

93{ return framebuffer_info_; }

◆ IsSubmitted()

bool flutter::SurfaceFrame::IsSubmitted ( ) const

Definition at line 61 of file surface_frame.cc.

61 {
62 return submitted_;
63}

◆ set_submit_info()

void flutter::SurfaceFrame::set_submit_info ( const SubmitInfo submit_info)
inline

Definition at line 95 of file surface_frame.h.

95 {
96 submit_info_ = submit_info;
97 }
const SubmitInfo & submit_info() const
Definition: surface_frame.h:98

◆ SkiaSurface()

sk_sp< SkSurface > flutter::SurfaceFrame::SkiaSurface ( ) const

Definition at line 69 of file surface_frame.cc.

69 {
70 return surface_;
71}

◆ Submit()

bool flutter::SurfaceFrame::Submit ( )

Definition at line 50 of file surface_frame.cc.

50 {
51 TRACE_EVENT0("flutter", "SurfaceFrame::Submit");
52 if (submitted_) {
53 return false;
54 }
55
56 submitted_ = PerformSubmit();
57
58 return submitted_;
59}

◆ submit_info()

const SubmitInfo & flutter::SurfaceFrame::submit_info ( ) const
inline

Definition at line 98 of file surface_frame.h.

98{ return submit_info_; }

The documentation for this class was generated from the following files: