13 OwningContext owning_context) {
17 return sk_make_sp<DlImageImpellerTexture>(std::move(texture), owning_context);
22 std::shared_ptr<Texture> y_texture,
23 std::shared_ptr<Texture> uv_texture,
25 if (!aiks_context || !y_texture || !uv_texture) {
29 std::move(y_texture), std::move(uv_texture), yuv_color_space);
37 fml::ScopedCleanupClosure restore_cache(
38 [&] { renderer.GetRenderTargetCache()->EnableCache(); });
40 std::optional<Snapshot> snapshot =
41 yuv_to_rgb_filter_contents->RenderToSnapshot(
43 {.coverage_limit = std::nullopt,
44 .sampler_descriptor = std::nullopt,
47 .label =
"MakeYUVToRGBFilter Snapshot"});
48 if (!snapshot.has_value()) {
66 OwningContext owning_context)
67 : texture_(
std::move(texture)), owning_context_(owning_context) {}
74 const std::shared_ptr<impeller::Context>&
context)
const {
81 return flutter::DlColorSpace::kSRGB;
83 switch (texture_->GetTextureDescriptor().format) {
86 return flutter::DlColorSpace::kExtendedSRGB;
88 return flutter::DlColorSpace::kSRGB;
108 return texture_ ? flutter::DlISize(texture_->GetSize()) : flutter::DlISize();
113 auto size =
sizeof(*this);
115 size += texture_->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
ContentContext & GetContentContext() const
std::shared_ptr< Texture > GetCachedTexture(const flutter::DlImage *image) const
Get a cached texture for the given image.
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
void SetCachedTexture(const flutter::DlImage *image, const std::shared_ptr< Texture > &texture) const
Set a cached texture for the given image.
std::shared_ptr< Context > GetContext() const
std::shared_ptr< Texture > GetCachedTexture(const ContentContext &renderer) const
static sk_sp< DlImageImpeller > MakeFromYUVTextures(AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
virtual std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const =0
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
flutter::DlColorSpace GetColorSpace() const override
DlImageImpellerTexture(std::shared_ptr< Texture > texture, OwningContext owning_context)
~DlImageImpellerTexture() override
bool isUIThreadSafe() const override
flutter::DlISize GetSize() const override
bool isOpaque() const override
std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const override
size_t GetApproximateByteSize() const override
void SetBlendMode(BlendMode blend_mode)
static std::shared_ptr< FilterContents > MakeYUVToRGBFilter(std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
std::shared_ptr< ContextGLES > context