| Flutter Impeller |

Public Member Functions | Protected Member Functions | List of all members
impeller::interop::Surface Class Reference

`#include <surface.h>`

Inheritance diagram for impeller::interop::Surface:

## Public Member Functions
| ~Surface () override
| Surface (const Surface &)=delete
Surface & | operator= (const Surface &)=delete
bool | IsValid () const
bool | DrawDisplayList (const DisplayList &dl) const
bool | Present () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Protected Member Functions
| Surface (Context &context, std::shared_ptr< impeller::Surface > surface)

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< Surface, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerSurface)>
using | InteropClass = Surface
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerSurface)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Detailed Description

Definition at line 18 of file surface.h.

## Constructor & Destructor Documentation

## ◆ ~Surface()

impeller::interop::Surface::~Surface | ( |  | ) |
| override default

## ◆ Surface() [1/2]

impeller::interop::Surface::Surface | ( | const Surface & |  | ) |
| delete

## ◆ Surface() [2/2]

impeller::interop::Surface::Surface | ( | Context & | context,
|  | std::shared_ptr< impeller::Surface > | surface
| ) |  |
| explicit protected

Definition at line 14 of file surface.cc.

15 : context_(Ref(&context)), surface_(std::move(surface)) {
16 is_valid_ =
17 context_ && context_->IsValid() && surface_ && surface_->IsValid();
18 }
impeller::interop::Ref
ScopedObject< Object > Ref(Object *object)
Definition: object.h:146

## Member Function Documentation

## ◆ DrawDisplayList()

bool impeller::interop::Surface::DrawDisplayList | ( | const DisplayList & | dl | ) | const

Definition at line 26 of file surface.cc.

26 {
27 if (!IsValid() || !dl.IsValid()) {
28 return false;
29 }
30
31 auto display_list = dl.GetDisplayList();
32 auto& content_context = context_->GetAiksContext().GetContentContext();
33 auto render_target = surface_->GetRenderTarget();
34
35 const auto cull_rect = Rect::MakeSize(surface_->GetSize());
36
37 auto result = RenderToTarget(content_context, render_target, display_list,
38 cull_rect, /*reset_host_buffer=*/true);
39 context_->GetContext()->ResetThreadLocalState();
40 return result;
41 }
impeller::interop::Surface::IsValid
bool IsValid() const
Definition: surface.cc:22
impeller::RenderToTarget
bool RenderToTarget(ContentContext &context, RenderTarget render_target, const sk_sp< flutter::DisplayList > &display_list, Rect cull_rect, bool reset_host_buffer, bool is_onscreen)
Render the provided display list to the render target.
Definition: dl_dispatcher.cc:1301
impeller::TRect< Scalar >::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150

References impeller::interop::DisplayList::GetDisplayList(), impeller::interop::DisplayList::IsValid(), IsValid(), impeller::TRect< Scalar >::MakeSize(), and impeller::RenderToTarget().

## ◆ IsValid()

bool impeller::interop::Surface::IsValid | ( |  | ) | const

Definition at line 22 of file surface.cc.

22 {
23 return is_valid_;
24 }

Referenced by DrawDisplayList(), and Present().

## ◆ operator=()

Surface& impeller::interop::Surface::operator= | ( | const Surface & |  | ) |
| delete

## ◆ Present()

bool impeller::interop::Surface::Present | ( |  | ) | const

Definition at line 43 of file surface.cc.

43 {
44 if (!IsValid()) {
45 return false;
46 }
47 return surface_->Present();
48 }

References IsValid().

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

- impeller/toolkit/interop/surface.h
- impeller/toolkit/interop/surface.cc