| 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 = default;
18 };
19
20 struct GLTextureTraits {
21 static GLTexture InvalidValue() { return {0}; }
22
23 static bool IsValid(const GLTexture& value) {
24 return value != InvalidValue();
25 }
26
27 static void Free(GLTexture image) {
28 glDeleteTextures(1, &image.texture_name);
29 }
30 };
31
32 using UniqueGLTexture = fml::UniqueObject<GLTexture, GLTextureTraits>;
33
34 } // namespace impeller
35
36 #endif // FLUTTER_IMPELLER_TOOLKIT_GLES_TEXTURE_H_
value
int32_t value
Definition: dl_golden_unittests.cc:459
impeller
Definition: allocation.cc:12
impeller::UniqueGLTexture
fml::UniqueObject< GLTexture, GLTextureTraits > UniqueGLTexture
Definition: texture.h:32
impeller::GLTexture
Definition: texture.h:14
impeller::GLTexture::operator==
constexpr bool operator==(const GLTexture &other) const =default
impeller::GLTexture::texture_name
GLuint texture_name
Definition: texture.h:15
impeller::GLTextureTraits
Definition: texture.h:20
impeller::GLTextureTraits::Free
static void Free(GLTexture image)
Definition: texture.h:27
impeller::GLTextureTraits::InvalidValue
static GLTexture InvalidValue()
Definition: texture.h:21
impeller::GLTextureTraits::IsValid
static bool IsValid(const GLTexture &value)
Definition: texture.h:23
gles.h