Flutter Engine
 
Loading...
Searching...
No Matches
image_external_texture_gl_impeller.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
9
10namespace flutter {
11
13 const std::shared_ptr<impeller::ContextGLES>& context,
14 int64_t id,
15 const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
16 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
18 : ImageExternalTextureGL(id, image_textury_entry, jni_facade, lifecycle),
19 impeller_context_(context) {}
20
21void ImageExternalTextureGLImpeller::Detach() {}
22
23void ImageExternalTextureGLImpeller::Attach(PaintContext& context) {
26 }
27}
28
29sk_sp<flutter::DlImage> ImageExternalTextureGLImpeller::CreateDlImage(
30 PaintContext& context,
31 const SkRect& bounds,
32 std::optional<HardwareBufferKey> id,
33 impeller::UniqueEGLImageKHR&& egl_image) {
38 desc.size = {static_cast<int>(bounds.width()),
39 static_cast<int>(bounds.height())};
40 desc.mip_count = 1;
41 auto texture = std::make_shared<impeller::TextureGLES>(
42 impeller_context_->GetReactor(), desc);
43 // The contents will be initialized later in the call to
44 // `glEGLImageTargetTexture2DOES` instead of by Impeller.
45 texture->MarkContentsInitialized();
46 texture->SetCoordinateSystem(
48 if (!texture->Bind()) {
49 return nullptr;
50 }
51 // Associate the hardware buffer image with the texture.
52 glEGLImageTargetTexture2DOES(
53 GL_TEXTURE_EXTERNAL_OES,
54 static_cast<GLeglImageOES>(egl_image.get().image));
55 gl_entries_[id.value_or(0)] = GlEntry{
56 .egl_image = std::move(egl_image),
57 };
59}
60
61} // namespace flutter
std::unordered_map< HardwareBufferKey, GlEntry > gl_entries_
void Attach(PaintContext &context) override
ImageExternalTextureGLImpeller(const std::shared_ptr< impeller::ContextGLES > &context, int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &hardware_buffer_texture_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade, ImageExternalTexture::ImageLifecycle lifecycle)
ImageLifecycle
Whether the last image should be reset when the context is destroyed.
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
FlTexture * texture
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
const uintptr_t id