| Flutter Impeller |

Public Member Functions | List of all members
impeller::AiksContext Class Reference

`#include <aiks_context.h>`

## Public Member Functions
| AiksContext (std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::optional< std::shared_ptr< RenderTargetAllocator >> render_target_allocator=std::nullopt)
| ~AiksContext ()
bool | IsValid () const
std::shared_ptr< Context > | GetContext () const
ContentContext & | GetContentContext () const
bool | Render (const Picture &picture, RenderTarget &render_target, bool reset_host_buffer)

## Detailed Description

Definition at line 19 of file aiks_context.h.

## Constructor & Destructor Documentation

## ◆ AiksContext()

impeller::AiksContext::AiksContext | ( | std::shared_ptr< Context > | context,
|  | std::shared_ptr< TypographerContext > | typographer_context,
|  | std::optional< std::shared_ptr< RenderTargetAllocator >> | render_target_allocator = `std::nullopt`
| ) |  |

Construct a new AiksContext.

Parameters

  context | The Impeller context that Aiks should use for allocating resources and executing device commands. Required.
  typographer_context | The text backend to use for rendering text. If `nullptr` is supplied, then attempting to draw text with Aiks will result in validation errors.
  render_target_allocator | Injects a render target allocator or allocates its own if none is supplied.

Definition at line 13 of file aiks_context.cc.

18 : context_(std::move(context)) {
19 if (!context_ || !context_->IsValid()) {
20 return;
21 }
22
23 content_context_ = std::make_unique<ContentContext>(
24 context_, std::move(typographer_context),
25 render_target_allocator.has_value() ? render_target_allocator.value()
26 : nullptr);
27 if (!content_context_->IsValid()) {
28 return;
29 }
30
31 is_valid_ = true;
32 }

## ◆ ~AiksContext()

impeller::AiksContext::~AiksContext | ( |  | ) |
| default

## Member Function Documentation

## ◆ GetContentContext()

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

Definition at line 44 of file aiks_context.cc.

44 {
45 return *content_context_;
46 }

Referenced by impeller::DlImageImpeller::MakeFromYUVTextures(), and impeller::DlPlayground::OpenPlaygroundHere().

## ◆ GetContext()

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

Definition at line 40 of file aiks_context.cc.

40 {
41 return context_;
42 }

Referenced by impeller::testing::VulkanScreenshotter::MakeScreenshot().

## ◆ IsValid()

bool impeller::AiksContext::IsValid | ( |  | ) | const

Definition at line 36 of file aiks_context.cc.

36 {
37 return is_valid_;
38 }

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

## ◆ Render()

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

Definition at line 48 of file aiks_context.cc.

50 {
51 if (!IsValid()) {
52 return false;
53 }
54
55 fml::ScopedCleanupClosure closure([&]() {
56 if (reset_host_buffer) {
57 content_context_->GetTransientsBuffer().Reset();
58 }
59 });
60 if (picture.pass) {
61 return picture.pass->Render(*content_context_, render_target);
62 }
63
64 return true;
65 }

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/aiks/aiks_context.h
- impeller/aiks/aiks_context.cc

impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:36