Flutter Impeller
image.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_EGL_IMAGE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_EGL_IMAGE_H_
7 
8 #include "flutter/fml/unique_object.h"
10 
11 namespace impeller {
12 
13 // Simple holder of an EGLImage and the owning EGLDisplay.
15  EGLImage image = EGL_NO_IMAGE;
16  EGLDisplay display = EGL_NO_DISPLAY;
17 
18  constexpr bool operator==(const EGLImageWithDisplay& other) const = default;
19 };
20 
23  return {EGL_NO_IMAGE, EGL_NO_DISPLAY};
24  }
25 
26  static bool IsValid(const EGLImageWithDisplay& value) {
27  return value != InvalidValue();
28  }
29 
30  static void Free(EGLImageWithDisplay image) {
31  eglDestroyImage(image.display, image.image);
32  }
33 };
34 
36  fml::UniqueObject<EGLImageWithDisplay, EGLImageWithDisplayTraits>;
37 
38 // Simple holder of an EGLImageKHR and the owning EGLDisplay.
40  EGLImageKHR image = EGL_NO_IMAGE_KHR;
41  EGLDisplay display = EGL_NO_DISPLAY;
42 
43  constexpr bool operator==(const EGLImageKHRWithDisplay& other) const =
44  default;
45 };
46 
49  return {EGL_NO_IMAGE_KHR, EGL_NO_DISPLAY};
50  }
51 
52  static bool IsValid(const EGLImageKHRWithDisplay& value) {
53  return value != InvalidValue();
54  }
55 
56  static void Free(EGLImageKHRWithDisplay image) {
57  eglDestroyImageKHR(image.display, image.image);
58  }
59 };
60 
62  fml::UniqueObject<EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits>;
63 
64 } // namespace impeller
65 
66 #endif // FLUTTER_IMPELLER_TOOLKIT_EGL_IMAGE_H_
int32_t value
fml::UniqueObject< EGLImageWithDisplay, EGLImageWithDisplayTraits > UniqueEGLImage
Definition: image.h:36
fml::UniqueObject< EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits > UniqueEGLImageKHR
Definition: image.h:62
constexpr bool operator==(const EGLImageKHRWithDisplay &other) const =default
static void Free(EGLImageKHRWithDisplay image)
Definition: image.h:56
static bool IsValid(const EGLImageKHRWithDisplay &value)
Definition: image.h:52
static EGLImageKHRWithDisplay InvalidValue()
Definition: image.h:48
constexpr bool operator==(const EGLImageWithDisplay &other) const =default
static bool IsValid(const EGLImageWithDisplay &value)
Definition: image.h:26
static void Free(EGLImageWithDisplay image)
Definition: image.h:30
static EGLImageWithDisplay InvalidValue()
Definition: image.h:22