| Flutter Windows Embedder |

external_texture_d3d.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_D3D_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_
7
8 #include <memory>
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/shell/platform/windows/angle_surface_manager.h"
12 #include "flutter/shell/platform/windows/external_texture.h"
13 #include "flutter/shell/platform/windows/gl_proc_table.h"
14
15 namespace flutter {
16
17 // An external texture that is backed by a DXGI surface.
18 class ExternalTextureD3d : public ExternalTexture {
19 public:
20 ExternalTextureD3d(
21 FlutterDesktopGpuSurfaceType type,
22 const FlutterDesktopGpuSurfaceTextureCallback texture_callback,
23 void* user_data,
24 const AngleSurfaceManager* surface_manager,
25 std::shared_ptr<GlProcTable> gl);
26 virtual ~ExternalTextureD3d();
27
28 // |ExternalTexture|
29 bool PopulateTexture(size_t width,
30 size_t height,
31 FlutterOpenGLTexture* opengl_texture) override;
32
33 private:
34 // Creates or updates the backing texture and associates it with the provided
35 // surface.
36 bool CreateOrUpdateTexture(
37 const FlutterDesktopGpuSurfaceDescriptor* descriptor);
38 // Detaches the previously attached surface, if any.
39 void ReleaseImage();
40
41 FlutterDesktopGpuSurfaceType type_;
42 const FlutterDesktopGpuSurfaceTextureCallback texture_callback_;
43 void* const user_data_;
44 const AngleSurfaceManager* surface_manager_;
45 std::shared_ptr<GlProcTable> gl_;
46 GLuint gl_texture_ = 0;
47 EGLSurface egl_surface_ = EGL_NO_SURFACE;
48 void* last_surface_handle_ = nullptr;
49
50 FML_DISALLOW_COPY_AND_ASSIGN(ExternalTextureD3d);
51 };
52
53 } // namespace flutter
54
55 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_
gl_proc_table.h
flutter::ExternalTextureD3d
Definition: external_texture_d3d.h:18
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:49
angle_surface_manager.h
FlutterDesktopGpuSurfaceType
FlutterDesktopGpuSurfaceType
Definition: flutter_texture_registrar.h:32
flutter::AngleSurfaceManager
Definition: angle_surface_manager.h:28
external_texture.h
type
enum flutter::testing::@69::KeyboardChange::Type type
flutter
Definition: accessibility_bridge_windows.cc:11
FlutterDesktopGpuSurfaceDescriptor
Definition: flutter_texture_registrar.h:70
flutter::ExternalTextureD3d::~ExternalTextureD3d
virtual ~ExternalTextureD3d()
Definition: external_texture_d3d.cc:24
flutter::ExternalTextureD3d::PopulateTexture
bool PopulateTexture(size_t width, size_t height, FlutterOpenGLTexture *opengl_texture) override
Definition: external_texture_d3d.cc:32
FlutterDesktopGpuSurfaceTextureCallback
const typedef FlutterDesktopGpuSurfaceDescriptor *(* FlutterDesktopGpuSurfaceTextureCallback)(size_t width, size_t height, void *user_data)
Definition: flutter_texture_registrar.h:125
flutter::ExternalTextureD3d::ExternalTextureD3d
ExternalTextureD3d(FlutterDesktopGpuSurfaceType type, const FlutterDesktopGpuSurfaceTextureCallback texture_callback, void *user_data, const AngleSurfaceManager *surface_manager, std::shared_ptr< GlProcTable > gl)
Definition: external_texture_d3d.cc:12
flutter::ExternalTexture
Definition: external_texture.h:16
texture_callback
FlutterDesktopPixelBufferTextureCallback texture_callback
Definition: texture_registrar_unittests.cc:26