Flutter Impeller
surface.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_SURFACE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_EGL_SURFACE_H_
7 
9 
10 namespace impeller {
11 namespace egl {
12 
13 //------------------------------------------------------------------------------
14 /// @brief An instance of an EGL surface. There is no ability to create
15 /// surfaces directly. Instead, one must be created using a Display
16 /// connection.
17 ///
18 class Surface {
19  public:
20  ~Surface();
21 
22  //----------------------------------------------------------------------------
23  /// @return True if this is a valid surface.
24  ///
25  bool IsValid() const;
26 
27  //----------------------------------------------------------------------------
28  /// @return Get the handle to the underlying surface.
29  ///
30  const EGLSurface& GetHandle() const;
31 
32  //----------------------------------------------------------------------------
33  /// @brief Present the surface. For an offscreen pixel buffer surface,
34  /// this is a no-op.
35  ///
36  /// @return True if the surface could be presented.
37  ///
38  bool Present() const;
39 
40  private:
41  friend class Display;
42 
43  EGLDisplay display_ = EGL_NO_DISPLAY;
44  EGLSurface surface_ = EGL_NO_SURFACE;
45 
46  Surface(EGLDisplay display, EGLSurface surface);
47 
48  Surface(const Surface&) = delete;
49 
50  Surface& operator=(const Surface&) = delete;
51 };
52 
53 } // namespace egl
54 } // namespace impeller
55 
56 #endif // FLUTTER_IMPELLER_TOOLKIT_EGL_SURFACE_H_
A connection to an EGL display. Only one connection per application instance is sufficient.
Definition: display.h:28
An instance of an EGL surface. There is no ability to create surfaces directly. Instead,...
Definition: surface.h:18
bool IsValid() const
Definition: surface.cc:25
bool Present() const
Present the surface. For an offscreen pixel buffer surface, this is a no-op.
Definition: surface.cc:29
const EGLSurface & GetHandle() const
Definition: surface.cc:21