Flutter Engine
flutter::SurfaceFrame Class Reference

#include <surface_frame.h>

Public Types

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

Public Member Functions

 SurfaceFrame (sk_sp< SkSurface > surface, bool supports_readback, const SubmitCallback &submit_callback)
 
 SurfaceFrame (sk_sp< SkSurface > surface, bool supports_readback, const SubmitCallback &submit_callback, std::unique_ptr< GLContextResult > context_result)
 
 ~SurfaceFrame ()
 
bool Submit ()
 
bool IsSubmitted () const
 
SkCanvas * SkiaCanvas ()
 
sk_sp< SkSurface > SkiaSurface () const
 
bool supports_readback ()
 

Detailed Description

Definition at line 19 of file surface_frame.h.

Member Typedef Documentation

◆ SubmitCallback

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

Definition at line 22 of file surface_frame.h.

Constructor & Destructor Documentation

◆ SurfaceFrame() [1/2]

flutter::SurfaceFrame::SurfaceFrame ( sk_sp< SkSurface >  surface,
bool  supports_readback,
const SubmitCallback submit_callback 
)

Definition at line 10 of file surface_frame.cc.

13  : surface_(surface),
14  supports_readback_(supports_readback),
15  submit_callback_(submit_callback) {
16  FML_DCHECK(submit_callback_);
17 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ SurfaceFrame() [2/2]

flutter::SurfaceFrame::SurfaceFrame ( sk_sp< SkSurface >  surface,
bool  supports_readback,
const SubmitCallback submit_callback,
std::unique_ptr< GLContextResult context_result 
)

Definition at line 19 of file surface_frame.cc.

References FML_DCHECK.

23  : submitted_(false),
24  surface_(surface),
25  supports_readback_(supports_readback),
26  submit_callback_(submit_callback),
27  context_result_(std::move(context_result)) {
28  FML_DCHECK(submit_callback_);
29 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ ~SurfaceFrame()

flutter::SurfaceFrame::~SurfaceFrame ( )

Definition at line 31 of file surface_frame.cc.

31  {
32  if (submit_callback_ && !submitted_) {
33  // Dropping without a Submit.
34  submit_callback_(*this, nullptr);
35  }
36 }

Member Function Documentation

◆ IsSubmitted()

bool flutter::SurfaceFrame::IsSubmitted ( ) const

Definition at line 48 of file surface_frame.cc.

48  {
49  return submitted_;
50 }

◆ SkiaCanvas()

SkCanvas * flutter::SurfaceFrame::SkiaCanvas ( )

Definition at line 52 of file surface_frame.cc.

Referenced by SkiaSurface().

52  {
53  return surface_ != nullptr ? surface_->getCanvas() : nullptr;
54 }

◆ SkiaSurface()

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

Definition at line 56 of file surface_frame.cc.

References SkiaCanvas().

Referenced by flutter::GPUSurfaceSoftware::AcquireFrame().

56  {
57  return surface_;
58 }

◆ Submit()

bool flutter::SurfaceFrame::Submit ( )

Definition at line 38 of file surface_frame.cc.

38  {
39  if (submitted_) {
40  return false;
41  }
42 
43  submitted_ = PerformSubmit();
44 
45  return submitted_;
46 }

◆ supports_readback()

bool flutter::SurfaceFrame::supports_readback ( )
inline

Definition at line 43 of file surface_frame.h.

43 { return supports_readback_; }

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