| Flutter Windows Embedder |

proc_table.cc
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 #include "flutter/shell/platform/windows/egl/proc_table.h"
6
7 #include <EGL/egl.h>
8
9 namespace flutter {
10 namespace egl {
11
12 std::shared_ptr<ProcTable> ProcTable::Create() {
13 auto gl = std::shared_ptr<ProcTable>(new ProcTable());
14
15 gl->gen_textures_ =
16 reinterpret_cast<GenTexturesProc>(::eglGetProcAddress("glGenTextures"));
17 gl->delete_textures_ = reinterpret_cast<DeleteTexturesProc>(
18 ::eglGetProcAddress("glDeleteTextures"));
19 gl->bind_texture_ =
20 reinterpret_cast<BindTextureProc>(::eglGetProcAddress("glBindTexture"));
21 gl->tex_parameteri_ = reinterpret_cast<TexParameteriProc>(
22 ::eglGetProcAddress("glTexParameteri"));
23 gl->tex_image_2d_ =
24 reinterpret_cast<TexImage2DProc>(::eglGetProcAddress("glTexImage2D"));
25
26 if (!gl->gen_textures_ || !gl->delete_textures_ || !gl->bind_texture_ ||
27 !gl->tex_parameteri_ || !gl->tex_image_2d_) {
28 return nullptr;
29 }
30
31 return gl;
32 }
33
34 ProcTable::ProcTable() = default;
35
36 ProcTable::~ProcTable() = default;
37
38 void ProcTable::GenTextures(GLsizei n, GLuint* textures) const {
39 gen_textures_(n, textures);
40 }
41
42 void ProcTable::DeleteTextures(GLsizei n, const GLuint* textures) const {
43 delete_textures_(n, textures);
44 }
45
46 void ProcTable::BindTexture(GLenum target, GLuint texture) const {
47 bind_texture_(target, texture);
48 }
49
50 void ProcTable::TexParameteri(GLenum target, GLenum pname, GLint param) const {
51 tex_parameteri_(target, pname, param);
52 }
53
54 void ProcTable::TexImage2D(GLenum target,
55 GLint level,
56 GLint internalformat,
57 GLsizei width,
58 GLsizei height,
59 GLint border,
60 GLenum format,
61 GLenum type,
62 const void* data) const {
63 tex_image_2d_(target, level, internalformat, width, height, border, format,
64 type, data);
65 }
66
67 } // namespace egl
68 } // namespace flutter
flutter::egl::ProcTable::BindTexture
virtual void BindTexture(GLenum target, GLuint texture) const
Definition: proc_table.cc:46
flutter::egl::ProcTable::TexParameteri
virtual void TexParameteri(GLenum target, GLenum pname, GLint param) const
Definition: proc_table.cc:50
flutter::egl::ProcTable::DeleteTextures
virtual void DeleteTextures(GLsizei n, const GLuint *textures) const
Definition: proc_table.cc:42
flutter::egl::ProcTable::ProcTable
ProcTable()
flutter::egl::ProcTable::GenTextures
virtual void GenTextures(GLsizei n, GLuint *textures) const
Definition: proc_table.cc:38
flutter::egl::ProcTable::Create
static std::shared_ptr< ProcTable > Create()
Definition: proc_table.cc:12
flutter::egl::ProcTable::~ProcTable
virtual ~ProcTable()
flutter::egl::ProcTable::TexImage2D
virtual void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data) const
Definition: proc_table.cc:54
type
enum flutter::testing::@93::KeyboardChange::Type type
flutter
Definition: accessibility_bridge_windows.cc:11
proc_table.h