1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program Tester Core
3*35238bceSAndroid Build Coastguard Worker * ----------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief EGL native pixmap abstraction
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "egluNativePixmap.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker namespace eglu
27*35238bceSAndroid Build Coastguard Worker {
28*35238bceSAndroid Build Coastguard Worker
29*35238bceSAndroid Build Coastguard Worker using namespace eglw;
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker // NativePixmap
32*35238bceSAndroid Build Coastguard Worker
NativePixmap(Capability capabilities)33*35238bceSAndroid Build Coastguard Worker NativePixmap::NativePixmap(Capability capabilities) : m_capabilities(capabilities)
34*35238bceSAndroid Build Coastguard Worker {
35*35238bceSAndroid Build Coastguard Worker }
36*35238bceSAndroid Build Coastguard Worker
getLegacyNative(void)37*35238bceSAndroid Build Coastguard Worker EGLNativePixmapType NativePixmap::getLegacyNative(void)
38*35238bceSAndroid Build Coastguard Worker {
39*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_LEGACY) == 0);
40*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePixmapSurface()", DE_NULL, __FILE__,
41*35238bceSAndroid Build Coastguard Worker __LINE__);
42*35238bceSAndroid Build Coastguard Worker }
43*35238bceSAndroid Build Coastguard Worker
getPlatformExtension(void)44*35238bceSAndroid Build Coastguard Worker void *NativePixmap::getPlatformExtension(void)
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0);
47*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePlatformPixmapSurfaceEXT()", DE_NULL,
48*35238bceSAndroid Build Coastguard Worker __FILE__, __LINE__);
49*35238bceSAndroid Build Coastguard Worker }
50*35238bceSAndroid Build Coastguard Worker
getPlatformNative(void)51*35238bceSAndroid Build Coastguard Worker void *NativePixmap::getPlatformNative(void)
52*35238bceSAndroid Build Coastguard Worker {
53*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0);
54*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePlatformPixmapSurface()", DE_NULL,
55*35238bceSAndroid Build Coastguard Worker __FILE__, __LINE__);
56*35238bceSAndroid Build Coastguard Worker }
57*35238bceSAndroid Build Coastguard Worker
readPixels(tcu::TextureLevel *)58*35238bceSAndroid Build Coastguard Worker void NativePixmap::readPixels(tcu::TextureLevel *)
59*35238bceSAndroid Build Coastguard Worker {
60*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_READ_PIXELS) == 0);
61*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativePixmap doesn't support readPixels", DE_NULL, __FILE__, __LINE__);
62*35238bceSAndroid Build Coastguard Worker }
63*35238bceSAndroid Build Coastguard Worker
64*35238bceSAndroid Build Coastguard Worker // NativePixmapFactory
65*35238bceSAndroid Build Coastguard Worker
NativePixmapFactory(const std::string & name,const std::string & description,NativePixmap::Capability capabilities)66*35238bceSAndroid Build Coastguard Worker NativePixmapFactory::NativePixmapFactory(const std::string &name, const std::string &description,
67*35238bceSAndroid Build Coastguard Worker NativePixmap::Capability capabilities)
68*35238bceSAndroid Build Coastguard Worker : FactoryBase(name, description)
69*35238bceSAndroid Build Coastguard Worker , m_capabilities(capabilities)
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker
~NativePixmapFactory(void)73*35238bceSAndroid Build Coastguard Worker NativePixmapFactory::~NativePixmapFactory(void)
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker }
76*35238bceSAndroid Build Coastguard Worker
createPixmap(NativeDisplay * nativeDisplay,EGLDisplay display,EGLConfig config,const EGLAttrib * attribList,int width,int height) const77*35238bceSAndroid Build Coastguard Worker NativePixmap *NativePixmapFactory::createPixmap(NativeDisplay *nativeDisplay, EGLDisplay display, EGLConfig config,
78*35238bceSAndroid Build Coastguard Worker const EGLAttrib *attribList, int width, int height) const
79*35238bceSAndroid Build Coastguard Worker {
80*35238bceSAndroid Build Coastguard Worker DE_UNREF(display && config && attribList);
81*35238bceSAndroid Build Coastguard Worker return createPixmap(nativeDisplay, width, height);
82*35238bceSAndroid Build Coastguard Worker }
83*35238bceSAndroid Build Coastguard Worker
84*35238bceSAndroid Build Coastguard Worker } // namespace eglu
85