diff --git a/engine/src/flutter/shell/platform/windows/external_texture_d3d.cc b/engine/src/flutter/shell/platform/windows/external_texture_d3d.cc index cd8785d717..7e5a84b6d5 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_d3d.cc +++ b/engine/src/flutter/shell/platform/windows/external_texture_d3d.cc @@ -4,9 +4,6 @@ #include "flutter/shell/platform/windows/external_texture_d3d.h" -#include -#include - #include "flutter/fml/logging.h" #include "flutter/shell/platform/embedder/embedder_struct_macros.h" diff --git a/engine/src/flutter/shell/platform/windows/external_texture_d3d.h b/engine/src/flutter/shell/platform/windows/external_texture_d3d.h index 771c7cb593..007484296a 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_d3d.h +++ b/engine/src/flutter/shell/platform/windows/external_texture_d3d.h @@ -5,11 +5,6 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_ -#include - -#include - -#include "flutter/shell/platform/common/public/flutter_texture_registrar.h" #include "flutter/shell/platform/windows/angle_surface_manager.h" #include "flutter/shell/platform/windows/external_texture.h" diff --git a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.cc b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.cc index 4dae259500..802eeef9e5 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.cc +++ b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.cc @@ -6,22 +6,17 @@ namespace flutter { -struct ExternalTexturePixelBufferState { - GLuint gl_texture = 0; -}; - ExternalTexturePixelBuffer::ExternalTexturePixelBuffer( - FlutterDesktopPixelBufferTextureCallback texture_callback, + const FlutterDesktopPixelBufferTextureCallback texture_callback, void* user_data, const GlProcs& gl_procs) - : state_(std::make_unique()), - texture_callback_(texture_callback), + : texture_callback_(texture_callback), user_data_(user_data), gl_(gl_procs) {} ExternalTexturePixelBuffer::~ExternalTexturePixelBuffer() { - if (state_->gl_texture != 0) { - gl_.glDeleteTextures(1, &state_->gl_texture); + if (gl_texture_ != 0) { + gl_.glDeleteTextures(1, &gl_texture_); } } @@ -35,7 +30,7 @@ bool ExternalTexturePixelBuffer::PopulateTexture( // Populate the texture object used by the engine. opengl_texture->target = GL_TEXTURE_2D; - opengl_texture->name = state_->gl_texture; + opengl_texture->name = gl_texture_; opengl_texture->format = GL_RGBA8_OES; opengl_texture->destruction_callback = nullptr; opengl_texture->user_data = nullptr; @@ -55,17 +50,17 @@ bool ExternalTexturePixelBuffer::CopyPixelBuffer(size_t& width, width = pixel_buffer->width; height = pixel_buffer->height; - if (state_->gl_texture == 0) { - gl_.glGenTextures(1, &state_->gl_texture); + if (gl_texture_ == 0) { + gl_.glGenTextures(1, &gl_texture_); - gl_.glBindTexture(GL_TEXTURE_2D, state_->gl_texture); + gl_.glBindTexture(GL_TEXTURE_2D, gl_texture_); gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else { - gl_.glBindTexture(GL_TEXTURE_2D, state_->gl_texture); + gl_.glBindTexture(GL_TEXTURE_2D, gl_texture_); } gl_.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixel_buffer->width, pixel_buffer->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, diff --git a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h index 527f06b32a..3e5e101046 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h +++ b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h @@ -5,23 +5,16 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_ -#include - -#include - #include "flutter/shell/platform/common/public/flutter_texture_registrar.h" - #include "flutter/shell/platform/windows/external_texture.h" namespace flutter { -typedef struct ExternalTexturePixelBufferState ExternalTexturePixelBufferState; - // An abstraction of an pixel-buffer based texture. class ExternalTexturePixelBuffer : public ExternalTexture { public: ExternalTexturePixelBuffer( - FlutterDesktopPixelBufferTextureCallback texture_callback, + const FlutterDesktopPixelBufferTextureCallback texture_callback, void* user_data, const GlProcs& gl_procs); @@ -41,10 +34,10 @@ class ExternalTexturePixelBuffer : public ExternalTexture { // by |texture_callback_| was invalid. bool CopyPixelBuffer(size_t& width, size_t& height); - std::unique_ptr state_; - FlutterDesktopPixelBufferTextureCallback texture_callback_ = nullptr; + const FlutterDesktopPixelBufferTextureCallback texture_callback_ = nullptr; void* const user_data_ = nullptr; const GlProcs& gl_; + GLuint gl_texture_ = 0; }; } // namespace flutter