Update contrib.
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
23 #include "eglendpointwrap.h"
24 #include "egltest_commscommon.h"
28 * TEglEndpointWrap is a simple class that presents all of the EGL endpoint
29 * extension functions without the user needing to perform an eglGetProcAddress()
30 * to obtain the function pointer. Each endpoint member function takes the same
31 * arguments as the EGL functions and returns the same types. After construction
32 * you should check the Error() function to ensure that all function pointers
33 * were resolved. Trying to use one of the endpoint functions in the event of a
34 * construction error will result in a panic.
38 TEglEndpointWrap::TEglEndpointWrap()
40 //Save all the endpoint function pointers. If an error occurs, log it to iError.
42 ipfnEglCreateEndpointNOK = reinterpret_cast<PFNEGLCREATEENDPOINTNOKPROC>(ProcAddressL("eglCreateEndpointNOK"));
43 ipfnEglDestroyEndpointNOK = reinterpret_cast<PFNEGLDESTROYENDPOINTNOKPROC>(ProcAddressL("eglDestroyEndpointNOK"));
44 ipfnEglGetEndpointAttribNOK = reinterpret_cast<PFNEGLGETENDPOINTATTRIBNOKPROC>(ProcAddressL("eglGetEndpointAttribNOK"));
45 ipfnEglSetEndpointAttribNOK = reinterpret_cast<PFNEGLSETENDPOINTATTRIBNOKPROC>(ProcAddressL("eglSetEndpointAttribNOK"));
46 ipfnEglEndpointBeginStreamingNOK = reinterpret_cast<PFNEGLENDPOINTBEGINSTREAMINGNOKPROC>(ProcAddressL("eglEndpointBeginStreamingNOK"));
47 ipfnEglEndpointEndStreamingNOK = reinterpret_cast<PFNEGLENDPOINTENDSTREAMINGNOKPROC>(ProcAddressL("eglEndpointEndStreamingNOK"));
48 ipfnEglAcquireImageNOK = reinterpret_cast<PFNEGLACQUIREIMAGENOKPROC>(ProcAddressL("eglAcquireImageNOK"));
49 ipfnEglReleaseImageNOK = reinterpret_cast<PFNEGLRELEASEIMAGENOKPROC>(ProcAddressL("eglReleaseImageNOK"));
50 ipfnEglGetEndpointDirtyAreaNOK = reinterpret_cast<PFNEGLGETENDPOINTDIRTYAREANOKPROC>(ProcAddressL("eglGetEndpointDirtyAreaNOK"));
51 ipfnEglEndpointRequestNotificationNOK = reinterpret_cast<PFNEGLENDPOINTREQUESTNOTIFICATIONNOKPROC>(ProcAddressL("eglEndpointRequestNotificationNOK"));
52 ipfnEglEndpointCancelNotificationNOK = reinterpret_cast<PFNEGLENDPOINTCANCELNOTIFICATIONNOKPROC>(ProcAddressL("eglEndpointCancelNotificationNOK"));
53 ipfnEglDestroyImageKHR = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(ProcAddressL("eglDestroyImageKHR"));
58 TInt TEglEndpointWrap::Error() const
64 TAnyFuncPtr TEglEndpointWrap::ProcAddressL(const char* aProcName) const
66 //get the function pointer and check for errors
67 TAnyFuncPtr func = reinterpret_cast<TAnyFuncPtr>(eglGetProcAddress(aProcName));
70 User::Leave(KErrNotFound);
76 EGLEndpointNOK TEglEndpointWrap::CreateEndpoint(EGLDisplay dpy, EGLenum type, EGLenum source_type,
77 EGLEndpointSourceNOK source, const EGLint *attrib_list) const
79 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
80 return ipfnEglCreateEndpointNOK(dpy, type, source_type, source, attrib_list);
84 EGLBoolean TEglEndpointWrap::DestroyEndpoint(EGLDisplay dpy, EGLEndpointNOK endpoint) const
86 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
87 return ipfnEglDestroyEndpointNOK(dpy, endpoint);
91 EGLint TEglEndpointWrap::GetEndpointAttrib(EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib) const
93 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
94 return ipfnEglGetEndpointAttribNOK(dpy, endpoint, attrib);
98 EGLBoolean TEglEndpointWrap::SetEndpointAttrib(EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib, EGLint value) const
100 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
101 return ipfnEglSetEndpointAttribNOK(dpy, endpoint, attrib, value);
105 EGLBoolean TEglEndpointWrap::EndpointBeginStreaming(EGLDisplay dpy, EGLEndpointNOK endpoint) const
107 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
108 return ipfnEglEndpointBeginStreamingNOK(dpy, endpoint);
112 EGLBoolean TEglEndpointWrap::EndpointEndStreaming(EGLDisplay dpy, EGLEndpointNOK endpoint) const
114 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
115 return ipfnEglEndpointEndStreamingNOK(dpy, endpoint);
119 EGLImageKHR TEglEndpointWrap::AcquireImage(EGLDisplay dpy, EGLEndpointNOK endpoint) const
121 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
122 return ipfnEglAcquireImageNOK(dpy, endpoint);
126 EGLBoolean TEglEndpointWrap::ReleaseImage(EGLDisplay dpy, EGLEndpointNOK endpoint, EGLImageKHR image, EGLenum api) const
128 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
129 return ipfnEglReleaseImageNOK(dpy, endpoint, image, api);
133 EGLint TEglEndpointWrap::GetEndpointDirtyArea(EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint* rects,
134 EGLint start_rect, EGLint max_rects, EGLBoolean collapse) const
136 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
137 return ipfnEglGetEndpointDirtyAreaNOK(dpy, endpoint, rects, start_rect, max_rects, collapse);
141 EGLBoolean TEglEndpointWrap::EndpointRequestNotification(EGLDisplay dpy, EGLEndpointNOK endpoint, EGLTRequestStatusNOK sync) const
143 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
144 return ipfnEglEndpointRequestNotificationNOK(dpy, endpoint, sync);
148 EGLBoolean TEglEndpointWrap::EndpointCancelNotification(EGLDisplay dpy, EGLEndpointNOK endpoint) const
150 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
151 return ipfnEglEndpointCancelNotificationNOK(dpy, endpoint);
155 EGLBoolean TEglEndpointWrap::DestroyImage(EGLDisplay dpy, EGLImageKHR image) const
157 ENDPOINT_ASSERT_DEBUG(iError == KErrNone, User::Invariant());
158 return ipfnEglDestroyImageKHR(dpy, image);