Home | History | Annotate | Download | only in egl
      1 #ifndef _EGLUUNIQUE_HPP
      2 #define _EGLUUNIQUE_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program Tester Core
      5  * ----------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief EGL unique resources
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "egluDefs.hpp"
     27 #include "egluHeaderWrapper.hpp"
     28 
     29 namespace eglu
     30 {
     31 
     32 class UniqueSurface
     33 {
     34 public:
     35 					UniqueSurface	(EGLDisplay display, EGLSurface surface);
     36 					~UniqueSurface	(void);
     37 
     38 	EGLSurface		operator*		(void) { return m_surface; }
     39 	operator		bool			(void) const { return m_surface != EGL_NO_SURFACE; }
     40 
     41 private:
     42 	EGLDisplay		m_display;
     43 	EGLSurface		m_surface;
     44 
     45 	// Disabled
     46 	UniqueSurface&	operator=		(const UniqueSurface&);
     47 					UniqueSurface	(const UniqueSurface&);
     48 };
     49 
     50 class UniqueContext
     51 {
     52 public:
     53 					UniqueContext	(EGLDisplay display, EGLContext context);
     54 					~UniqueContext	(void);
     55 
     56 	EGLContext		operator*		(void) { return m_context; }
     57 	operator		bool			(void) const { return m_context != EGL_NO_CONTEXT; }
     58 
     59 private:
     60 	EGLDisplay		m_display;
     61 	EGLContext		m_context;
     62 
     63 	// Disabled
     64 	UniqueContext	operator=		(const UniqueContext&);
     65 					UniqueContext	(const UniqueContext&);
     66 };
     67 
     68 class ScopedCurrentContext
     69 {
     70 public:
     71 	ScopedCurrentContext	(EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context);
     72 	~ScopedCurrentContext	(void);
     73 
     74 private:
     75 	EGLDisplay		m_display;
     76 };
     77 
     78 } // eglu
     79 
     80 #endif // _EGLUUNIQUE_HPP
     81