Flutter Engine
The Flutter Engine
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
11namespace impeller {
12
13// Simple holder of an GLTexture and the owning EGLDisplay.
14struct GLTexture {
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
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
39
40} // namespace impeller
41
42#endif // FLUTTER_IMPELLER_TOOLKIT_GLES_TEXTURE_H_
uint8_t value
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static void Free(GLTexture image)
Definition: texture.h:33
static GLTexture InvalidValue()
Definition: texture.h:27
static bool IsValid(const GLTexture &value)
Definition: texture.h:29
constexpr bool operator==(const GLTexture &other) const
Definition: texture.h:17
constexpr bool operator!=(const GLTexture &other) const
Definition: texture.h:21
GLuint texture_name
Definition: texture.h:15