| Flutter Windows Embedder |

external_texture.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_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_H_
7
8 #include "flutter/shell/platform/embedder/embedder.h"
9
10 #include <GLES2/gl2.h>
11 #include <GLES2/gl2ext.h>
12
13 namespace flutter {
14
15 typedef void (*glGenTexturesProc)(GLsizei n, GLuint* textures);
16 typedef void (*glDeleteTexturesProc)(GLsizei n, const GLuint* textures);
17 typedef void (*glBindTextureProc)(GLenum target, GLuint texture);
18 typedef void (*glTexParameteriProc)(GLenum target, GLenum pname, GLint param);
19 typedef void (*glTexImage2DProc)(GLenum target,
20 GLint level,
21 GLint internalformat,
22 GLsizei width,
23 GLsizei height,
24 GLint border,
25 GLenum format,
26 GLenum type,
27 const void* data);
28
29 // A struct containing pointers to resolved gl* functions.
30 struct GlProcs {
31 glGenTexturesProc glGenTextures;
32 glDeleteTexturesProc glDeleteTextures;
33 glBindTextureProc glBindTexture;
34 glTexParameteriProc glTexParameteri;
35 glTexImage2DProc glTexImage2D;
36 bool valid;
37 };
38
39 // Abstract external texture.
40 class ExternalTexture {
41 public:
42 virtual ~ExternalTexture() = default;
43
44 // Returns the unique id of this texture.
45 int64_t texture_id() const { return reinterpret_cast<int64_t>(this); };
46
47 // Attempts to populate the specified |opengl_texture| with texture details
48 // such as the name, width, height and the pixel format.
49 // Returns true on success.
50 virtual bool PopulateTexture(size_t width,
51 size_t height,
52 FlutterOpenGLTexture* opengl_texture) = 0;
53 };
54
55 } // namespace flutter
56
57 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_H_
flutter::GlProcs::glTexParameteri
glTexParameteriProc glTexParameteri
Definition: external_texture.h:34
flutter::GlProcs::valid
bool valid
Definition: external_texture.h:36
flutter::glDeleteTexturesProc
void(* glDeleteTexturesProc)(GLsizei n, const GLuint *textures)
Definition: external_texture.h:16
flutter::ExternalTexture::~ExternalTexture
virtual ~ExternalTexture()=default
flutter::glTexImage2DProc
void(* glTexImage2DProc)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data)
Definition: external_texture.h:19
type
enum flutter::testing::@66::KeyboardChange::Type type
flutter::GlProcs::glTexImage2D
glTexImage2DProc glTexImage2D
Definition: external_texture.h:35
flutter::ExternalTexture::texture_id
int64_t texture_id() const
Definition: external_texture.h:45
flutter::ExternalTexture::PopulateTexture
virtual bool PopulateTexture(size_t width, size_t height, FlutterOpenGLTexture *opengl_texture)=0
flutter::glGenTexturesProc
void(* glGenTexturesProc)(GLsizei n, GLuint *textures)
Definition: external_texture.h:15
flutter::glTexParameteriProc
void(* glTexParameteriProc)(GLenum target, GLenum pname, GLint param)
Definition: external_texture.h:18
flutter::GlProcs::glBindTexture
glBindTextureProc glBindTexture
Definition: external_texture.h:33
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::glBindTextureProc
void(* glBindTextureProc)(GLenum target, GLuint texture)
Definition: external_texture.h:17
flutter::GlProcs
Definition: external_texture.h:30
flutter::GlProcs::glGenTextures
glGenTexturesProc glGenTextures
Definition: external_texture.h:31
flutter::ExternalTexture
Definition: external_texture.h:40
flutter::GlProcs::glDeleteTextures
glDeleteTexturesProc glDeleteTextures
Definition: external_texture.h:32