Flutter Engine
 
Loading...
Searching...
No Matches
image_external_texture_gl.h
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
5#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
7
8#include <memory>
9#include <optional>
10#include <unordered_map>
11
15
16namespace flutter {
17
19 public:
21 int64_t id,
22 const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
23 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
25
26 protected:
27 // |ImageExternalTexture|
28 void Attach(PaintContext& context) override;
29
30 // |ImageExternalTexture|
31 void Detach() override;
32
33 // |ImageExternalTexture|
34 void ProcessFrame(PaintContext& context, const SkRect& bounds) override;
35
36 virtual sk_sp<flutter::DlImage> CreateDlImage(
37 PaintContext& context,
38 const SkRect& bounds,
39 std::optional<HardwareBufferKey> id,
40 impeller::UniqueEGLImageKHR&& egl_image) = 0;
41
42 void UpdateImage(JavaLocalRef& hardware_buffer,
43 const SkRect& bounds,
44 PaintContext& context);
45
46 impeller::UniqueEGLImageKHR CreateEGLImage(AHardwareBuffer* buffer);
47
52
53 // Each GL entry is keyed off of the currently active
54 // hardware buffers and evicted when the hardware buffer
55 // is removed from the LRU cache.
56 std::unordered_map<HardwareBufferKey, GlEntry> gl_entries_;
57
59};
60
61} // namespace flutter
62
63#endif // FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
void ProcessFrame(PaintContext &context, const SkRect &bounds) override
Subclasses override this method to bind the latest representation of the hardware buffer wrapped by t...
void UpdateImage(JavaLocalRef &hardware_buffer, const SkRect &bounds, PaintContext &context)
virtual sk_sp< flutter::DlImage > CreateDlImage(PaintContext &context, const SkRect &bounds, std::optional< HardwareBufferKey > id, impeller::UniqueEGLImageKHR &&egl_image)=0
impeller::UniqueEGLImageKHR CreateEGLImage(AHardwareBuffer *buffer)
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTextureGL)
std::unordered_map< HardwareBufferKey, GlEntry > gl_entries_
void Attach(PaintContext &context) override
External texture peered to a sequence of android.hardware.HardwareBuffers.
ImageLifecycle
Whether the last image should be reset when the context is destroyed.
std::nullptr_t JavaLocalRef
impeller::UniqueGLTexture texture
impeller::UniqueEGLImageKHR egl_image