| Flutter Windows Embedder |

external_texture_pixelbuffer.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_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_
7
8 #include "flutter/fml/macros.h"
9 #include "flutter/shell/platform/common/public/flutter_texture_registrar.h"
10 #include "flutter/shell/platform/windows/egl/proc_table.h"
11 #include "flutter/shell/platform/windows/external_texture.h"
12
13 namespace flutter {
14
15 // An abstraction of an pixel-buffer based texture.
16 class ExternalTexturePixelBuffer : public ExternalTexture {
17 public:
18 ExternalTexturePixelBuffer(
19 const FlutterDesktopPixelBufferTextureCallback texture_callback,
20 void* user_data,
21 std::shared_ptr<egl::ProcTable> gl);
22
23 virtual ~ExternalTexturePixelBuffer();
24
25 // |ExternalTexture|
26 bool PopulateTexture(size_t width,
27 size_t height,
28 FlutterOpenGLTexture* opengl_texture) override;
29
30 private:
31 // Attempts to copy the pixel buffer returned by |texture_callback_| to
32 // OpenGL.
33 // The |width| and |height| will be set to the actual bounds of the copied
34 // pixel buffer.
35 // Returns true on success or false if the pixel buffer returned
36 // by |texture_callback_| was invalid.
37 bool CopyPixelBuffer(size_t& width, size_t& height);
38
39 const FlutterDesktopPixelBufferTextureCallback texture_callback_ = nullptr;
40 void* const user_data_ = nullptr;
41 std::shared_ptr<egl::ProcTable> gl_;
42 GLuint gl_texture_ = 0;
43
44 FML_DISALLOW_COPY_AND_ASSIGN(ExternalTexturePixelBuffer);
45 };
46
47 } // namespace flutter
48
49 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_
flutter::ExternalTexture
Definition: external_texture.h:16
flutter::ExternalTexturePixelBuffer
Definition: external_texture_pixelbuffer.h:16
flutter::ExternalTexturePixelBuffer::PopulateTexture
bool PopulateTexture(size_t width, size_t height, FlutterOpenGLTexture *opengl_texture) override
Definition: external_texture_pixelbuffer.cc:23
flutter::ExternalTexturePixelBuffer::~ExternalTexturePixelBuffer
virtual ~ExternalTexturePixelBuffer()
Definition: external_texture_pixelbuffer.cc:17
flutter::ExternalTexturePixelBuffer::ExternalTexturePixelBuffer
ExternalTexturePixelBuffer(const FlutterDesktopPixelBufferTextureCallback texture_callback, void *user_data, std::shared_ptr< egl::ProcTable > gl)
Definition: external_texture_pixelbuffer.cc:9
external_texture.h
flutter_texture_registrar.h
FlutterDesktopPixelBufferTextureCallback
const FlutterDesktopPixelBuffer *(* FlutterDesktopPixelBufferTextureCallback)(size_t width, size_t height, void *user_data)
Definition: flutter_texture_registrar.h:116
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:53
flutter
Definition: accessibility_bridge_windows.cc:11
proc_table.h
texture_callback
FlutterDesktopPixelBufferTextureCallback texture_callback
Definition: texture_registrar_unittests.cc:26