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