22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- #include " flutter/shell/platform/android/hardware_buffer_external_texture_gl .h"
5+ #include " flutter/shell/platform/android/image_external_texture_gl .h"
66
77#include < android/hardware_buffer_jni.h>
88#include < android/sensor.h>
2828
2929namespace flutter {
3030
31- HardwareBufferExternalTextureGL::HardwareBufferExternalTextureGL (
31+ ImageExternalTextureGL::ImageExternalTextureGL (
3232 int64_t id,
3333 const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
3434 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
35- : HardwareBufferExternalTexture (id, image_texture_entry, jni_facade) {}
35+ : ImageExternalTexture (id, image_texture_entry, jni_facade) {}
3636
37- void HardwareBufferExternalTextureGL ::Attach (PaintContext& context) {
37+ void ImageExternalTextureGL ::Attach (PaintContext& context) {
3838 if (state_ == AttachmentState::kUninitialized ) {
3939 if (!android_image_.is_null ()) {
4040 JavaLocalRef hardware_buffer = HardwareBufferFor (android_image_);
@@ -47,11 +47,11 @@ void HardwareBufferExternalTextureGL::Attach(PaintContext& context) {
4747 }
4848}
4949
50- void HardwareBufferExternalTextureGL ::Detach () {
50+ void ImageExternalTextureGL ::Detach () {
5151 egl_image_.reset ();
5252}
5353
54- bool HardwareBufferExternalTextureGL ::MaybeSwapImages () {
54+ bool ImageExternalTextureGL ::MaybeSwapImages () {
5555 JavaLocalRef image = AcquireLatestImage ();
5656 if (image.is_null ()) {
5757 return false ;
@@ -72,7 +72,7 @@ bool HardwareBufferExternalTextureGL::MaybeSwapImages() {
7272 return true ;
7373}
7474
75- impeller::UniqueEGLImageKHR HardwareBufferExternalTextureGL ::CreateEGLImage (
75+ impeller::UniqueEGLImageKHR ImageExternalTextureGL ::CreateEGLImage (
7676 AHardwareBuffer* hardware_buffer) {
7777 if (hardware_buffer == nullptr ) {
7878 return impeller::UniqueEGLImageKHR ();
@@ -98,31 +98,31 @@ impeller::UniqueEGLImageKHR HardwareBufferExternalTextureGL::CreateEGLImage(
9898 return impeller::UniqueEGLImageKHR (maybe_image);
9999}
100100
101- HardwareBufferExternalTextureGLSkia::HardwareBufferExternalTextureGLSkia (
101+ ImageExternalTextureGLSkia::ImageExternalTextureGLSkia (
102102 const std::shared_ptr<AndroidContextGLSkia>& context,
103103 int64_t id,
104104 const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
105105 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
106- : HardwareBufferExternalTextureGL (id, image_texture_entry, jni_facade) {}
106+ : ImageExternalTextureGL (id, image_texture_entry, jni_facade) {}
107107
108- void HardwareBufferExternalTextureGLSkia ::Attach (PaintContext& context) {
108+ void ImageExternalTextureGLSkia ::Attach (PaintContext& context) {
109109 if (state_ == AttachmentState::kUninitialized ) {
110110 // After this call state_ will be AttachmentState::kAttached and egl_image_
111111 // will have been created if we still have an Image associated with us.
112- HardwareBufferExternalTextureGL ::Attach (context);
112+ ImageExternalTextureGL ::Attach (context);
113113 GLuint texture_name;
114114 glGenTextures (1 , &texture_name);
115115 texture_.reset (impeller::GLTexture{texture_name});
116116 }
117117}
118118
119- void HardwareBufferExternalTextureGLSkia ::Detach () {
120- HardwareBufferExternalTextureGL ::Detach ();
119+ void ImageExternalTextureGLSkia ::Detach () {
120+ ImageExternalTextureGL ::Detach ();
121121 texture_.reset ();
122122}
123123
124- void HardwareBufferExternalTextureGLSkia ::ProcessFrame (PaintContext& context,
125- const SkRect& bounds) {
124+ void ImageExternalTextureGLSkia ::ProcessFrame (PaintContext& context,
125+ const SkRect& bounds) {
126126 const bool swapped = MaybeSwapImages ();
127127 if (!swapped && !egl_image_.is_valid ()) {
128128 // Nothing to do.
@@ -132,7 +132,7 @@ void HardwareBufferExternalTextureGLSkia::ProcessFrame(PaintContext& context,
132132 dl_image_ = CreateDlImage (context, bounds);
133133}
134134
135- void HardwareBufferExternalTextureGLSkia ::BindImageToTexture (
135+ void ImageExternalTextureGLSkia ::BindImageToTexture (
136136 const impeller::UniqueEGLImageKHR& image,
137137 GLuint tex) {
138138 if (!image.is_valid () || tex == 0 ) {
@@ -143,7 +143,7 @@ void HardwareBufferExternalTextureGLSkia::BindImageToTexture(
143143 (GLeglImageOES)image.get ().image );
144144}
145145
146- sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLSkia ::CreateDlImage (
146+ sk_sp<flutter::DlImage> ImageExternalTextureGLSkia ::CreateDlImage (
147147 PaintContext& context,
148148 const SkRect& bounds) {
149149 GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES,
@@ -155,26 +155,24 @@ sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLSkia::CreateDlImage(
155155 kRGBA_8888_SkColorType , kPremul_SkAlphaType , nullptr ));
156156}
157157
158- HardwareBufferExternalTextureGLImpeller::
159- HardwareBufferExternalTextureGLImpeller (
160- const std::shared_ptr<impeller::ContextGLES>& context,
161- int64_t id,
162- const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
163- const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
164- : HardwareBufferExternalTextureGL(id, image_textury_entry, jni_facade),
158+ ImageExternalTextureGLImpeller::ImageExternalTextureGLImpeller (
159+ const std::shared_ptr<impeller::ContextGLES>& context,
160+ int64_t id,
161+ const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
162+ const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
163+ : ImageExternalTextureGL(id, image_textury_entry, jni_facade),
165164 impeller_context_ (context) {}
166165
167- void HardwareBufferExternalTextureGLImpeller ::Detach () {}
166+ void ImageExternalTextureGLImpeller ::Detach () {}
168167
169- void HardwareBufferExternalTextureGLImpeller ::Attach (PaintContext& context) {
168+ void ImageExternalTextureGLImpeller ::Attach (PaintContext& context) {
170169 if (state_ == AttachmentState::kUninitialized ) {
171- HardwareBufferExternalTextureGL ::Attach (context);
170+ ImageExternalTextureGL ::Attach (context);
172171 }
173172}
174173
175- void HardwareBufferExternalTextureGLImpeller::ProcessFrame (
176- PaintContext& context,
177- const SkRect& bounds) {
174+ void ImageExternalTextureGLImpeller::ProcessFrame (PaintContext& context,
175+ const SkRect& bounds) {
178176 const bool swapped = MaybeSwapImages ();
179177 if (!swapped && !egl_image_.is_valid ()) {
180178 // Nothing to do.
@@ -183,7 +181,7 @@ void HardwareBufferExternalTextureGLImpeller::ProcessFrame(
183181 dl_image_ = CreateDlImage (context, bounds);
184182}
185183
186- sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLImpeller ::CreateDlImage (
184+ sk_sp<flutter::DlImage> ImageExternalTextureGLImpeller ::CreateDlImage (
187185 PaintContext& context,
188186 const SkRect& bounds) {
189187 impeller::TextureDescriptor desc;
0 commit comments