|
1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 * |
|
3 * Permission is hereby granted, free of charge, to any person obtaining a |
|
4 * copy of this software and /or associated documentation files |
|
5 * (the "Materials "), to deal in the Materials without restriction, |
|
6 * including without limitation the rights to use, copy, modify, merge, |
|
7 * publish, distribute, sublicense, and/or sell copies of the Materials, |
|
8 * and to permit persons to whom the Materials are furnished to do so, |
|
9 * subject to the following conditions: |
|
10 * |
|
11 * The above copyright notice and this permission notice shall be included |
|
12 * in all copies or substantial portions of the Materials. |
|
13 * |
|
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
|
20 * THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
21 * |
|
22 * Initial Contributors: |
|
23 * Nokia Corporation - initial contribution. |
|
24 * |
|
25 * Contributors: |
|
26 * |
|
27 * Description: |
|
28 * |
|
29 */ |
|
30 |
|
31 #ifndef _EGLCONFIG_H_ |
|
32 #define _EGLCONFIG_H_ |
|
33 |
|
34 #include <EGL/egl.h> |
|
35 #include "ColorDescriptor.h" |
|
36 #include "TransparentColor.h" |
|
37 |
|
38 class CEGLConfig |
|
39 { |
|
40 public: |
|
41 CEGLConfig(void); |
|
42 CEGLConfig( CColorDescriptor& colorDescriptor, |
|
43 EGLBoolean bindToTexRGB, /* EGL_BIND_TO_TEXTURE_RGB*/ |
|
44 EGLBoolean bindToTexRGBA, /* EGL_BIND_TO_TEXTURE_RGBA */ |
|
45 EGLenum configCaveat, /* EGL_CONFIG_CAVEAT */ |
|
46 EGLint configId, /* EGL_CONFIG_ID */ |
|
47 EGLint conformant, /* EGL_CONFORMANT */ |
|
48 EGLint depthSize, /* EGL_DEPTH_SIZE */ |
|
49 EGLint level, /* EGL_LEVEL */ |
|
50 EGLint maxSwapInterval, /* EGL_MAX_SWAP_INTERVAL */ |
|
51 EGLint minSwapInterval, /* EGL_MIN_SWAP_INTERVAL */ |
|
52 EGLBoolean nativeRenderable, /* EGL_NATIVE_RENDERABLE */ |
|
53 EGLint nativeVisualType, /* EGL_NATIVE_VIDUAL_TYPE */ |
|
54 EGLint renderableType, /* EGL_RENDERABLE_TYPE */ |
|
55 EGLint sampleBuffers, /* EGL_SAMPLE_BUFFERS */ |
|
56 EGLint samples, /* EGL_SAMPLES */ |
|
57 EGLint stencilSize, /* EGL_STENCIL_SIZE */ |
|
58 EGLint surfaceType, |
|
59 CTransparentColor* transparentColor ); |
|
60 |
|
61 ~CEGLConfig(void); |
|
62 |
|
63 /* |
|
64 Setting up config values. |
|
65 Return EGL_NO_ERROR if all ok and |
|
66 EGL_BAD_PARAMETER if some conflict with parameters |
|
67 */ |
|
68 EGLint SetUpConfig( EGLint red, EGLint green, EGLint blue, |
|
69 EGLint luminance, EGLint alpha, |
|
70 EGLint alphaMask, EGLint samples, EGLint bpp, |
|
71 EGLint id ); |
|
72 |
|
73 public: |
|
74 inline void SetId( int id ) { m_configId = id; } |
|
75 inline EGLint Id() const { return m_configId; } |
|
76 EGLBoolean SetAttribute( EGLint attribute, EGLint value ); |
|
77 EGLint GetAttribute( EGLint attribute ) const; |
|
78 inline CColorDescriptor* GetDescriptor() { return &m_colorDescriptor; } |
|
79 |
|
80 bool operator>( const CEGLConfig& rhs ) const; |
|
81 bool operator<( const CEGLConfig& rhs ) const; |
|
82 bool Match( const CEGLConfig& filter) const; |
|
83 CEGLConfig& operator=( const CEGLConfig& rhs ); |
|
84 bool IsCompatible( const CEGLConfig& config, const EGLenum contextApi ) const; |
|
85 |
|
86 private: |
|
87 EGLint m_bufferSize; /* EGL_BUFFER_SIZE */ |
|
88 CColorDescriptor m_colorDescriptor; |
|
89 EGLBoolean m_bindToTexRGB; /* EGL_BIND_TO_TEXTURE_RGB*/ |
|
90 EGLBoolean m_bindToTexRGBA; /* EGL_BIND_TO_TEXTURE_RGBA */ |
|
91 EGLenum m_configCaveat; /* EGL_CONFIG_CAVEAT */ |
|
92 EGLint m_configId; /* EGL_CONFIG_ID */ |
|
93 EGLint m_conformant; /* EGL_CONFORMANT */ |
|
94 EGLint m_depthSize; /* EGL_DEPTH_SIZE */ |
|
95 EGLint m_level; /* EGL_LEVEL */ |
|
96 EGLint m_maxPbufferWidth; /* EGL_MAX_PBUFFER_WIDTH */ |
|
97 EGLint m_maxPbufferHeight; /* EGL_MAX_PBUFFER_HEIGHT */ |
|
98 EGLint m_maxPbufferPixels; /* EGL_MAX_PBUFFER_PIXELS */ |
|
99 EGLint m_maxSwapInterval; /* EGL_MAX_SWAP_INTERVAL */ |
|
100 EGLint m_minSwapInterval; /* EGL_MIN_SWAP_INTERVAL */ |
|
101 EGLBoolean m_nativeRenderable; /* EGL_NATIVE_RENDERABLE */ |
|
102 EGLint m_nativeVisualId; /* EGL_NATIVE_VISUAL_ID */ |
|
103 EGLint m_nativeVisualType; /* EGL_NATIVE_VISUAL_TYPE */ |
|
104 EGLint m_renderableType; /* EGL_RENDERABLE_TYPE */ |
|
105 EGLint m_sampleBuffers; /* EGL_SAMPLE_BUFFERS */ |
|
106 EGLint m_samples; /* EGL_SAMPLES */ |
|
107 EGLint m_stencilSize; /* EGL_STENCIL_SIZE */ |
|
108 |
|
109 EGLint m_surfaceType; /* EGL_SURFACE_TYPE = |
|
110 EGL_PBUFFER_BIT, |
|
111 EGL_PIXMAP_BIT, |
|
112 EGL_WINDOW_BIT, |
|
113 EGL_VG_COLORSPACE_LINEAR_BIT, |
|
114 EGL_VG_ALPHA_FORMAT_PRE_BIT, |
|
115 EGL_MULTISAMPLE_RESOLVE_BOX_BIT, |
|
116 EGL_SWAP_BEHAVIOR_PRESERVED_BIT */ |
|
117 |
|
118 CTransparentColor m_transparentColor; |
|
119 }; |
|
120 #endif //_EGLCONFIG_H_ |