Flutter Impeller
impeller::AiksContext Class Reference

#include <aiks_context.h>

Public Member Functions

 AiksContext (std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context)
 
 ~AiksContext ()
 
bool IsValid () const
 
std::shared_ptr< ContextGetContext () const
 
ContentContextGetContentContext () const
 
bool Render (const Picture &picture, RenderTarget &render_target)
 

Detailed Description

Definition at line 20 of file aiks_context.h.

Constructor & Destructor Documentation

◆ AiksContext()

impeller::AiksContext::AiksContext ( std::shared_ptr< Context context,
std::shared_ptr< TypographerContext typographer_context 
)

Construct a new AiksContext.

Parameters
contextThe Impeller context that Aiks should use for allocating resources and executing device commands. Required.
typographer_contextThe text backend to use for rendering text. If nullptr is supplied, then attempting to draw text with Aiks will result in validation errors.

Definition at line 12 of file aiks_context.cc.

15  : context_(std::move(context)) {
16  if (!context_ || !context_->IsValid()) {
17  return;
18  }
19 
20  content_context_ = std::make_unique<ContentContext>(
21  context_, std::move(typographer_context));
22  if (!content_context_->IsValid()) {
23  return;
24  }
25 
26  is_valid_ = true;
27 }

◆ ~AiksContext()

impeller::AiksContext::~AiksContext ( )
default

Member Function Documentation

◆ GetContentContext()

ContentContext & impeller::AiksContext::GetContentContext ( ) const

◆ GetContext()

std::shared_ptr< Context > impeller::AiksContext::GetContext ( ) const

Definition at line 35 of file aiks_context.cc.

35  {
36  return context_;
37 }

Referenced by impeller::AiksInspector::RenderInspector().

◆ IsValid()

bool impeller::AiksContext::IsValid ( ) const

Definition at line 31 of file aiks_context.cc.

31  {
32  return is_valid_;
33 }

Referenced by impeller::DlPlayground::OpenPlaygroundHere(), impeller::AiksPlayground::OpenPlaygroundHere(), and Render().

◆ Render()

bool impeller::AiksContext::Render ( const Picture picture,
RenderTarget render_target 
)

Definition at line 43 of file aiks_context.cc.

43  {
44  if (!IsValid()) {
45  return false;
46  }
47 
48  if (picture.pass) {
49  return picture.pass->Render(*content_context_, render_target);
50  }
51 
52  return true;
53 }

References IsValid(), and impeller::Picture::pass.

Referenced by impeller::DlPlayground::OpenPlaygroundHere(), and impeller::AiksPlayground::OpenPlaygroundHere().


The documentation for this class was generated from the following files:
impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:31