1 /*
2 * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 #include "tcuOhosNativeWindow.hpp"
17 #include "egluGLContextFactory.hpp"
18 #include "eglwLibrary.hpp"
19 #include "eglwFunctions.hpp"
20 #include "eglwEnums.hpp"
21 #include "deUniquePtr.hpp"
22
23 #include "ohos_context_i.h"
24
25 namespace tcu
26 {
27 namespace OHOS_ROSEN
28 {
29 namespace egl
30 {
31
32 using std::string;
33 using de::MovePtr;
34 using de::UniquePtr;
35 using glu::ContextFactory;
36 using eglu::GLContextFactory;
37 using eglu::NativeDisplay;
38 using eglu::NativeDisplayFactory;
39 using eglu::NativeWindow;
40 using eglu::NativeWindowFactory;
41 using eglu::NativePixmap;
42 using eglu::NativePixmapFactory;
43 using eglu::WindowParams;
44 using tcu::TextureLevel;
45
OhosWindow(OhosDisplay & display,const WindowParams & params)46 OhosWindow::OhosWindow (OhosDisplay& display, const WindowParams& params)
47 : NativeWindow (CAPABILITIES)
48 {
49 //TODO: 创建rosen window
50 if (display.getPlatformNative() != nullptr) {
51 printf("OhosWindow params: width=%d, height=%d\n", params.width, params.height);
52 }
53 OHOS::OhosContextI::GetInstance().OhosWindowResize(params.width,params.height);
54 printf("OhosWindow::OhosWindow\n");
55 }
56
getLegacyNative(void)57 eglw::EGLNativeWindowType OhosWindow::getLegacyNative (void)
58 {
59 //TODO: 创建rosen window
60 printf("OhosWindow::getLegacyNative\n");
61 return OHOS::OhosContextI::GetInstance().GetNativeWindowEx();
62 }
63
getPlatformExtension(void)64 void* OhosWindow::getPlatformExtension (void)
65 {
66 //TODO: 创建rosen window
67 printf("OhosWindow::getPlatformExtension\n");
68 return nullptr;
69 }
70
getPlatformNative(void)71 void* OhosWindow::getPlatformNative (void)
72 {
73 //TODO: 创建rosen window
74 printf("OhosWindow::getPlatformNative\n");
75 return nullptr;
76 }
77
getSurfaceSize(void) const78 IVec2 OhosWindow::getSurfaceSize (void) const
79 {
80 //TODO: 设置surface
81 IVec2 ret;
82 return ret;
83 }
84
setSurfaceSize(IVec2 size)85 void OhosWindow::setSurfaceSize (IVec2 size)
86 {
87 //TODO: 设置size
88 printf("setSurfaceSize IVec2: %d\n", size.x());
89 }
90
91 } // egl
92 } // OHOS
93 } // tcu