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_CONTEXT_H
17 #define FRAMEWORKS_OPENGL_WRAPPER_EGL_WRAPPER_CONTEXT_H
18 
19 #include <EGL/egl.h>
20 #include "egl_wrapper_object.h"
21 #include "egl_defs.h"
22 namespace OHOS {
23 class EglWrapperDisplay;
24 
25 class EglWrapperContext : public EglWrapperObject {
26 public:
27     EglWrapperContext(EglWrapperDisplay *disp, EGLContext context,
28         EGLint version = EglWrapperDispatchTable::GLESV1_INDEX);
29     void SetCurrentSurface(EGLSurface draw, EGLSurface read);
30     EGLSurface GetCurrentSurface(EGLint type) const;
31     static EglWrapperContext *GetWrapperContext(EGLContext ctx);
GetEglContext()32     inline EGLContext GetEglContext() const
33     {
34         return context_;
35     };
GetEglVersion()36     inline EGLint GetEglVersion() const
37     {
38         return version_;
39     };
40 protected:
41     ~EglWrapperContext() override;
42 private:
43     EGLContext context_;
44     EGLSurface read_;
45     EGLSurface draw_;
46     EGLint version_;
47 };
48 } // namespace OHOS
49 #endif // FRAMEWORKS_OPENGL_WRAPPER_EGL_WRAPPER_CONTEXT_H
50