• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAMEWORKS_OPENGL_WRAPPER_EGL_WRAPPER_SURFACE_H
17 #define FRAMEWORKS_OPENGL_WRAPPER_EGL_WRAPPER_SURFACE_H
18 
19 #include <EGL/egl.h>
20 #include <EGL/eglext.h>
21 #include "egl_wrapper_object.h"
22 #include "external_window.h"
23 #include "surface.h"
24 #include "window.h"
25 
26 namespace OHOS {
27 class EglWrapperDisplay;
28 
29 class EglWrapperSurface : public EglWrapperObject {
30 public:
31     EglWrapperSurface(EglWrapperDisplay *disp, EGLSurface surf,
32                       NativeWindowType window = nullptr, EGLint colorSpace = EGL_UNKNOWN);
33     static EglWrapperSurface *GetWrapperSurface(EGLSurface surf);
GetEglSurface()34     inline EGLSurface GetEglSurface() const
35     {
36         return surf_;
37     };
38 
GetNativeWindow()39     inline NativeWindowType GetNativeWindow() const
40     {
41         return window_;
42     };
43 
44     static void Disconnect(OHNativeWindow *window);
45 
GetColorSpace()46     EGLint GetColorSpace() const
47     {
48         return colorSpace_;
49     }
50 
51     EGLBoolean GetColorSpaceAttribute(EGLint attribute, EGLint* value) const;
52 
53 protected:
54     ~EglWrapperSurface() override;
55 private:
56     EGLSurface surf_;
57     NativeWindowType window_;
58     EGLint colorSpace_;
59 };
60 } // namespace OHOS
61 #endif // FRAMEWORKS_OPENGL_WRAPPER_EGL_WRAPPER_SURFACE_H
62