@@ -29,49 +29,13 @@ bool ExternalTexturePixelGL::PopulateTexture(
2929 size_t width,
3030 size_t height,
3131 FlutterOpenGLTexture* opengl_texture) {
32- if (!CopyPixelBuffer (width, height)) {
33- return false ;
34- }
35-
36- // Populate the texture object used by the engine.
37- opengl_texture->target = GL_TEXTURE_2D;
38- opengl_texture->name = state_->gl_texture ;
39- opengl_texture->format = GL_RGBA8;
40- opengl_texture->destruction_callback = nullptr ;
41- opengl_texture->user_data = nullptr ;
42- opengl_texture->width = width;
43- opengl_texture->height = height;
44- return true ;
32+ return CopyPixelBuffer (width, height);
4533}
4634
4735bool ExternalTexturePixelGL::CopyPixelBuffer (size_t & width, size_t & height) {
48- if (!texture_callback_) {
49- return false ;
50- }
51-
52- const FlutterDesktopPixelBuffer* pixel_buffer =
53- texture_callback_ (width, height, user_data_);
54-
55- if (!pixel_buffer || !pixel_buffer->buffer ) {
56- return false ;
57- }
58-
59- width = pixel_buffer->width ;
60- height = pixel_buffer->height ;
61-
62- if (state_->gl_texture == 0 ) {
63- glGenTextures (1 , &state_->gl_texture );
64- glBindTexture (GL_TEXTURE_2D, state_->gl_texture );
65- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
66- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
67- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
68- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
69- } else {
70- glBindTexture (GL_TEXTURE_2D, state_->gl_texture );
36+ if (texture_callback_ && user_data_) {
37+ return true ;
7138 }
72- glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, pixel_buffer->width ,
73- pixel_buffer->height , 0 , GL_RGBA, GL_UNSIGNED_BYTE,
74- pixel_buffer->buffer );
75- return true ;
39+ return false ;
7640}
7741} // namespace flutter
0 commit comments