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