1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program Tester Core
3 * ----------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief EGL native window abstraction
22 *//*--------------------------------------------------------------------*/
23
24 #include "egluNativeWindow.hpp"
25
26 namespace eglu
27 {
28
29 using namespace eglw;
30
31 // NativeWindow
32
NativeWindow(Capability capabilities)33 NativeWindow::NativeWindow(Capability capabilities) : m_capabilities(capabilities)
34 {
35 }
36
getLegacyNative(void)37 EGLNativeWindowType NativeWindow::getLegacyNative(void)
38 {
39 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_LEGACY) == 0);
40 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreateWindowSurface()", DE_NULL, __FILE__,
41 __LINE__);
42 }
43
getPlatformExtension(void)44 void *NativeWindow::getPlatformExtension(void)
45 {
46 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0);
47 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurfaceEXT()", DE_NULL,
48 __FILE__, __LINE__);
49 }
50
getPlatformNative(void)51 void *NativeWindow::getPlatformNative(void)
52 {
53 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0);
54 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurface()", DE_NULL,
55 __FILE__, __LINE__);
56 }
57
getSurfaceSize(void) const58 tcu::IVec2 NativeWindow::getSurfaceSize(void) const
59 {
60 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_SURFACE_SIZE) == 0);
61 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support querying the surface size", DE_NULL, __FILE__,
62 __LINE__);
63 }
64
setSurfaceSize(tcu::IVec2 size)65 void NativeWindow::setSurfaceSize(tcu::IVec2 size)
66 {
67 DE_UNREF(size);
68 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_SET_SURFACE_SIZE) == 0);
69 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support resizing the surface", DE_NULL, __FILE__,
70 __LINE__);
71 }
72
getScreenSize(void) const73 tcu::IVec2 NativeWindow::getScreenSize(void) const
74 {
75 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_SCREEN_SIZE) == 0);
76 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support querying the size of the window on the screen",
77 DE_NULL, __FILE__, __LINE__);
78 }
79
readScreenPixels(tcu::TextureLevel *) const80 void NativeWindow::readScreenPixels(tcu::TextureLevel *) const
81 {
82 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_READ_SCREEN_PIXELS) == 0);
83 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support readScreenPixels", DE_NULL, __FILE__, __LINE__);
84 }
85
setVisibility(WindowParams::Visibility visibility)86 void NativeWindow::setVisibility(WindowParams::Visibility visibility)
87 {
88 DE_UNREF(visibility);
89 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CHANGE_VISIBILITY) == 0);
90 throw tcu::NotSupportedError("eglu::NativeWindow doesn't support changing visibility", DE_NULL, __FILE__, __LINE__);
91 }
92
93 // NativeWindowFactory
94
NativeWindowFactory(const std::string & name,const std::string & description,NativeWindow::Capability capabilities)95 NativeWindowFactory::NativeWindowFactory(const std::string &name, const std::string &description,
96 NativeWindow::Capability capabilities)
97 : FactoryBase(name, description)
98 , m_capabilities(capabilities)
99 {
100 }
101
~NativeWindowFactory(void)102 NativeWindowFactory::~NativeWindowFactory(void)
103 {
104 }
105
createWindow(NativeDisplay * nativeDisplay,EGLDisplay display,EGLConfig config,const EGLAttrib * attribList,const WindowParams & params) const106 NativeWindow *NativeWindowFactory::createWindow(NativeDisplay *nativeDisplay, EGLDisplay display, EGLConfig config,
107 const EGLAttrib *attribList, const WindowParams ¶ms) const
108 {
109 DE_UNREF(display && config && attribList);
110 return createWindow(nativeDisplay, params);
111 }
112
113 } // namespace eglu
114