Flutter Impeller
impeller::DlImageImpeller Class Referenceabstract

#include <dl_image_impeller.h>

Inheritance diagram for impeller::DlImageImpeller:
impeller::DlImageImpellerTexture

Public Member Functions

Type GetImageType () const override
 
const DlImageImpeller * asImpellerImage () const override
 
bool isTextureBacked () const override
 
virtual std::shared_ptr< Texture > GetImpellerTexture (const std::shared_ptr< Context > &context) const =0
 
std::shared_ptr< Texture > GetCachedTexture (const ContentContext &renderer) const
 

Static Public Member Functions

static sk_sp< DlImageImpeller > Make (std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
 
static sk_sp< DlImageImpeller > MakeFromYUVTextures (AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
 

Detailed Description

Definition at line 17 of file dl_image_impeller.h.

Member Function Documentation

◆ asImpellerImage()

const DlImageImpeller* impeller::DlImageImpeller::asImpellerImage ( ) const
inlineoverride

Definition at line 23 of file dl_image_impeller.h.

23 { return this; }

◆ GetCachedTexture()

std::shared_ptr< Texture > impeller::DlImageImpeller::GetCachedTexture ( const ContentContext &  renderer) const

Definition at line 54 of file dl_image_impeller.cc.

55  {
56  auto texture = renderer.GetCachedTexture(this);
57  if (texture) {
58  return texture;
59  }
60  texture = GetImpellerTexture(renderer.GetContext());
61  renderer.SetCachedTexture(this, texture);
62  return texture;
63 }
virtual std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const =0

References impeller::ContentContext::GetCachedTexture(), impeller::ContentContext::GetContext(), GetImpellerTexture(), and impeller::ContentContext::SetCachedTexture().

◆ GetImageType()

Type impeller::DlImageImpeller::GetImageType ( ) const
inlineoverride

Definition at line 20 of file dl_image_impeller.h.

20 { return Type::kImpeller; }

◆ GetImpellerTexture()

virtual std::shared_ptr<Texture> impeller::DlImageImpeller::GetImpellerTexture ( const std::shared_ptr< Context > &  context) const
pure virtual

Implemented in impeller::DlImageImpellerTexture.

Referenced by GetCachedTexture().

◆ isTextureBacked()

bool impeller::DlImageImpeller::isTextureBacked ( ) const
inlineoverride

Definition at line 26 of file dl_image_impeller.h.

26 { return true; }

◆ Make()

sk_sp< DlImageImpeller > impeller::DlImageImpeller::Make ( std::shared_ptr< Texture >  texture,
OwningContext  owning_context = OwningContext::kIO 
)
static

Definition at line 12 of file dl_image_impeller.cc.

13  {
14  if (!texture) {
15  return nullptr;
16  }
17  return sk_make_sp<DlImageImpellerTexture>(std::move(texture), owning_context);
18 }

Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateDlImageForFixture(), MakeFromYUVTextures(), impeller::interop::Texture::MakeImage(), impeller::interop::ReadSamplersAndUniforms(), and impeller::testing::TEST_P().

◆ MakeFromYUVTextures()

sk_sp< DlImageImpeller > impeller::DlImageImpeller::MakeFromYUVTextures ( AiksContext *  aiks_context,
std::shared_ptr< Texture >  y_texture,
std::shared_ptr< Texture >  uv_texture,
YUVColorSpace  yuv_color_space 
)
static

Definition at line 20 of file dl_image_impeller.cc.

24  {
25  if (!aiks_context || !y_texture || !uv_texture) {
26  return nullptr;
27  }
28  auto yuv_to_rgb_filter_contents = FilterContents::MakeYUVToRGBFilter(
29  std::move(y_texture), std::move(uv_texture), yuv_color_space);
30  impeller::Entity entity;
32 
33  // Disable the render target cache so that this snapshot's texture will not
34  // be reused later by other operations.
35  const auto& renderer = aiks_context->GetContentContext();
36  renderer.GetRenderTargetCache()->DisableCache();
37  fml::ScopedCleanupClosure restore_cache(
38  [&] { renderer.GetRenderTargetCache()->EnableCache(); });
39 
40  std::optional<Snapshot> snapshot =
41  yuv_to_rgb_filter_contents->RenderToSnapshot(
42  renderer, entity,
43  {.coverage_limit = std::nullopt,
44  .sampler_descriptor = std::nullopt,
45  .msaa_enabled = true,
46  .mip_count = 1,
47  .label = "MakeYUVToRGBFilter Snapshot"});
48  if (!snapshot.has_value()) {
49  return nullptr;
50  }
51  return impeller::DlImageImpeller::Make(snapshot->texture);
52 }
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
void SetBlendMode(BlendMode blend_mode)
Definition: entity.cc:98
static std::shared_ptr< FilterContents > MakeYUVToRGBFilter(std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)

References impeller::AiksContext::GetContentContext(), impeller::ContentContext::GetRenderTargetCache(), impeller::kSrc, Make(), impeller::FilterContents::MakeYUVToRGBFilter(), and impeller::Entity::SetBlendMode().


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