| Flutter Impeller |

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_IMPELLER_TOOLKIT_GLES_TEXTURE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_GLES_TEXTURE_H_
7
8 #include "flutter/fml/unique_object.h"
9 #include "flutter/impeller/toolkit/gles/gles.h"
10
11 namespace impeller {
12
13 // Simple holder of an GLTexture and the owning EGLDisplay.
14 struct GLTexture {
15 GLuint texture_name;
16
17 constexpr bool operator==(const GLTexture& other) const {
18 return texture_name == other.texture_name;
19 }
20
21 constexpr bool operator!=(const GLTexture& other) const {
22 return !(*this == other);
23 }
24 };
25
26 struct GLTextureTraits {
27 static GLTexture InvalidValue() { return {0}; }
28
29 static bool IsValid(const GLTexture& value) {
30 return value != InvalidValue();
31 }
32
33 static void Free(GLTexture image) {
34 glDeleteTextures(1, &image.texture_name);
35 }
36 };
37
38 using UniqueGLTexture = fml::UniqueObject<GLTexture, GLTextureTraits>;
39
40 } // namespace impeller
41
42 #endif // FLUTTER_IMPELLER_TOOLKIT_GLES_TEXTURE_H_
impeller::UniqueGLTexture
fml::UniqueObject< GLTexture, GLTextureTraits > UniqueGLTexture
Definition: texture.h:38
impeller::GLTextureTraits::IsValid
static bool IsValid(const GLTexture &value)
Definition: texture.h:29
impeller::GLTexture::operator==
constexpr bool operator==(const GLTexture &other) const
Definition: texture.h:17
gles.h
impeller::GLTextureTraits::InvalidValue
static GLTexture InvalidValue()
Definition: texture.h:27
impeller::GLTexture::operator!=
constexpr bool operator!=(const GLTexture &other) const
Definition: texture.h:21
impeller::GLTextureTraits
Definition: texture.h:26
impeller::GLTextureTraits::Free
static void Free(GLTexture image)
Definition: texture.h:33
impeller::GLTexture::texture_name
GLuint texture_name
Definition: texture.h:15
impeller::GLTexture
Definition: texture.h:14
impeller
Definition: aiks_context.cc:10