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 {
19  return image == other.image && display == other.display;
20  }
21 
22  constexpr bool operator!=(const EGLImageWithDisplay& other) const {
23  return !(*this == other);
24  }
25 };
26 
29  return {EGL_NO_IMAGE, EGL_NO_DISPLAY};
30  }
31 
32  static bool IsValid(const EGLImageWithDisplay& value) {
33  return value != InvalidValue();
34  }
35 
36  static void Free(EGLImageWithDisplay image) {
37  eglDestroyImage(image.display, image.image);
38  }
39 };
40 
42  fml::UniqueObject<EGLImageWithDisplay, EGLImageWithDisplayTraits>;
43 
44 // Simple holder of an EGLImageKHR and the owning EGLDisplay.
46  EGLImageKHR image = EGL_NO_IMAGE_KHR;
47  EGLDisplay display = EGL_NO_DISPLAY;
48 
49  constexpr bool operator==(const EGLImageKHRWithDisplay& other) const {
50  return image == other.image && display == other.display;
51  }
52 
53  constexpr bool operator!=(const EGLImageKHRWithDisplay& other) const {
54  return !(*this == other);
55  }
56 };
57 
60  return {EGL_NO_IMAGE_KHR, EGL_NO_DISPLAY};
61  }
62 
63  static bool IsValid(const EGLImageKHRWithDisplay& value) {
64  return value != InvalidValue();
65  }
66 
67  static void Free(EGLImageKHRWithDisplay image) {
68  eglDestroyImageKHR(image.display, image.image);
69  }
70 };
71 
73  fml::UniqueObject<EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits>;
74 
75 } // namespace impeller
76 
77 #endif // FLUTTER_IMPELLER_TOOLKIT_EGL_IMAGE_H_
int32_t value
fml::UniqueObject< EGLImageWithDisplay, EGLImageWithDisplayTraits > UniqueEGLImage
Definition: image.h:42
fml::UniqueObject< EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits > UniqueEGLImageKHR
Definition: image.h:73
constexpr bool operator==(const EGLImageKHRWithDisplay &other) const
Definition: image.h:49
constexpr bool operator!=(const EGLImageKHRWithDisplay &other) const
Definition: image.h:53
static void Free(EGLImageKHRWithDisplay image)
Definition: image.h:67
static bool IsValid(const EGLImageKHRWithDisplay &value)
Definition: image.h:63
static EGLImageKHRWithDisplay InvalidValue()
Definition: image.h:59
constexpr bool operator==(const EGLImageWithDisplay &other) const
Definition: image.h:18
constexpr bool operator!=(const EGLImageWithDisplay &other) const
Definition: image.h:22
static bool IsValid(const EGLImageWithDisplay &value)
Definition: image.h:32
static void Free(EGLImageWithDisplay image)
Definition: image.h:36
static EGLImageWithDisplay InvalidValue()
Definition: image.h:28