Flutter Engine
The 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 <unordered_map>
9
10#include "flutter/fml/platform/android/scoped_java_ref.h"
11#include "flutter/shell/platform/android/image_external_texture.h"
12
13#include "flutter/impeller/renderer/backend/gles/context_gles.h"
14#include "flutter/impeller/renderer/backend/gles/gles.h"
15#include "flutter/impeller/renderer/backend/gles/texture_gles.h"
16#include "flutter/impeller/toolkit/egl/egl.h"
17#include "flutter/impeller/toolkit/egl/image.h"
18#include "flutter/impeller/toolkit/gles/texture.h"
19#include "flutter/shell/platform/android/android_context_gl_skia.h"
20
21namespace flutter {
22
24 public:
26 int64_t id,
27 const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
28 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
29
30 protected:
31 void Attach(PaintContext& context) override;
32 void Detach() override;
33 void ProcessFrame(PaintContext& context, const SkRect& bounds) override;
34 void UpdateImage(JavaLocalRef& hardware_buffer,
35 const SkRect& bounds,
36 PaintContext& context);
37
39 PaintContext& context,
40 const SkRect& bounds,
41 std::optional<HardwareBufferKey> id,
42 impeller::UniqueEGLImageKHR&& egl_image) = 0;
43
45
50
51 // Each GL entry is keyed off of the currently active
52 // hardware buffers and evicted when the hardware buffer
53 // is removed from the LRU cache.
54 std::unordered_map<HardwareBufferKey, GlEntry> gl_entries_;
55
57};
58
60 public:
62 const std::shared_ptr<AndroidContextGLSkia>& context,
63 int64_t id,
64 const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
65 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
66
67 private:
68 void Attach(PaintContext& context) override;
69 void Detach() override;
70
71 void BindImageToTexture(const impeller::UniqueEGLImageKHR& image, GLuint tex);
72
74 PaintContext& context,
75 const SkRect& bounds,
76 std::optional<HardwareBufferKey> id,
77 impeller::UniqueEGLImageKHR&& egl_image) override;
78
80};
81
83 public:
85 const std::shared_ptr<impeller::ContextGLES>& context,
86 int64_t id,
88 hardware_buffer_texture_entry,
89 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
90
91 private:
92 void Attach(PaintContext& context) override;
93 void Detach() override;
94
96 PaintContext& context,
97 const SkRect& bounds,
98 std::optional<HardwareBufferKey> id,
99 impeller::UniqueEGLImageKHR&& egl_image) override;
100
101 const std::shared_ptr<impeller::ContextGLES> impeller_context_;
102
104};
105
106} // namespace flutter
107
108#endif // FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
struct AHardwareBuffer AHardwareBuffer
void Attach(PaintContext &context) override
sk_sp< flutter::DlImage > CreateDlImage(PaintContext &context, const SkRect &bounds, std::optional< HardwareBufferKey > id, impeller::UniqueEGLImageKHR &&egl_image) override
void Attach(PaintContext &context) override
sk_sp< flutter::DlImage > CreateDlImage(PaintContext &context, const SkRect &bounds, std::optional< HardwareBufferKey > id, impeller::UniqueEGLImageKHR &&egl_image) override
void ProcessFrame(PaintContext &context, const SkRect &bounds) override
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
sk_sp< SkImage > image
Definition examples.cpp:29
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
std::nullptr_t JavaLocalRef
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition switches.h:126