Changeset 846 for trunk/src/gui/egl/qeglproperties.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/egl/qeglproperties.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 44 44 45 45 #include "qeglproperties_p.h" 46 #include "qeglcontext_p.h" 46 47 47 48 QT_BEGIN_NAMESPACE 48 49 #include "qegl_p.h"50 51 49 52 50 // Initialize a property block. … … 61 59 for (int name = 0x3020; name <= 0x304F; ++name) { 62 60 EGLint value; 63 if (name != EGL_NONE && eglGetConfigAttrib(QEgl Context::display(), cfg, name, &value))61 if (name != EGL_NONE && eglGetConfigAttrib(QEgl::display(), cfg, name, &value)) 64 62 setValue(name, value); 65 63 } … … 83 81 case EGL_BLUE_SIZE: return 0; 84 82 case EGL_ALPHA_SIZE: return 0; 85 #if defined(EGL_LUMINANCE_SIZE)83 #ifdef EGL_LUMINANCE_SIZE 86 84 case EGL_LUMINANCE_SIZE: return 0; 87 85 #endif 88 #if defined(EGL_ALPHA_MASK_SIZE)86 #ifdef EGL_ALPHA_MASK_SIZE 89 87 case EGL_ALPHA_MASK_SIZE: return 0; 90 88 #endif 91 #if defined(EGL_BIND_TO_TEXTURE_RGB)89 #ifdef EGL_BIND_TO_TEXTURE_RGB 92 90 case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE; 93 91 #endif 94 #if defined(EGL_BIND_TO_TEXTURE_RGBA)92 #ifdef EGL_BIND_TO_TEXTURE_RGBA 95 93 case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE; 96 94 #endif 97 #if defined(EGL_COLOR_BUFFER_TYPE)95 #ifdef EGL_COLOR_BUFFER_TYPE 98 96 case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER; 99 97 #endif … … 106 104 case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE; 107 105 case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE; 108 #if defined(EGL_RENDERABLE_TYPE)106 #ifdef EGL_RENDERABLE_TYPE 109 107 case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT; 110 108 #endif … … 118 116 case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE; 119 117 120 #if defined(EGL_VERSION_1_3)118 #ifdef EGL_VERSION_1_3 121 119 case EGL_CONFORMANT: return 0; 122 120 case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE; … … 166 164 return false; 167 165 } 166 167 void QEglProperties::setDeviceType(int devType) 168 { 169 if (devType == QInternal::Pixmap || devType == QInternal::Image) 170 setValue(EGL_SURFACE_TYPE, EGL_PIXMAP_BIT); 171 else if (devType == QInternal::Pbuffer) 172 setValue(EGL_SURFACE_TYPE, EGL_PBUFFER_BIT); 173 else 174 setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); 175 } 176 168 177 169 178 // Sets the red, green, blue, and alpha sizes based on a pixel format. … … 207 216 void QEglProperties::setRenderableType(QEgl::API api) 208 217 { 209 #if defined(EGL_RENDERABLE_TYPE)218 #ifdef EGL_RENDERABLE_TYPE 210 219 #if defined(QT_OPENGL_ES_2) 211 220 if (api == QEgl::OpenGL) … … 214 223 if (api == QEgl::OpenGL) 215 224 setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT); 216 #endif 217 #if defined(EGL_OPENVG_BIT) 225 #elif defined(EGL_OPENGL_BIT) 226 if (api == QEgl::OpenGL) 227 setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT); 228 #endif 229 #ifdef EGL_OPENVG_BIT 218 230 if (api == QEgl::OpenVG) 219 231 setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT); … … 230 242 bool QEglProperties::reduceConfiguration() 231 243 { 244 #ifdef EGL_SWAP_BEHAVIOR 245 if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE) 246 removeValue(EGL_SWAP_BEHAVIOR); 247 #endif 248 249 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 250 // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't 251 // find a config which supports pre-multiplied formats, remove the flag on the surface type: 252 EGLint surfaceType = value(EGL_SURFACE_TYPE); 253 if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { 254 surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; 255 setValue(EGL_SURFACE_TYPE, surfaceType); 256 return true; 257 } 258 #endif 232 259 // EGL chooses configs with the highest color depth over 233 260 // those with smaller (but faster) lower color depths. One 234 261 // way around this is to set EGL_BUFFER_SIZE to 16, which 235 262 // trumps the others. Of course, there may not be a 16-bit 236 // config ava liable, so it's the first restraint we remove.263 // config available, so it's the first restraint we remove. 237 264 if (value(EGL_BUFFER_SIZE) == 16) { 238 265 removeValue(EGL_BUFFER_SIZE); … … 254 281 if (removeValue(EGL_DEPTH_SIZE)) 255 282 return true; 256 #if defined(EGL_BIND_TO_TEXTURE_RGB)283 #ifdef EGL_BIND_TO_TEXTURE_RGB 257 284 if (removeValue(EGL_BIND_TO_TEXTURE_RGB)) 258 285 return true; … … 269 296 str += QLatin1String("\n "); 270 297 str += tag; 271 }272 273 void QEglProperties::dumpAllConfigs()274 {275 EGLint count = 0;276 eglGetConfigs(QEglContext::display(), 0, 0, &count);277 if (count < 1)278 return;279 280 EGLConfig *configs = new EGLConfig [count];281 eglGetConfigs(QEglContext::display(), configs, count, &count);282 for (EGLint index = 0; index < count; ++index)283 qWarning() << QEglProperties(configs[index]).toString();284 delete [] configs;285 298 } 286 299 … … 308 321 if ((val & EGL_OPENGL_ES2_BIT) != 0) 309 322 types += QLatin1String("es2"); 323 #endif 324 #ifdef EGL_OPENGL_BIT 325 if ((val & EGL_OPENGL_BIT) != 0) 326 types += QLatin1String("gl"); 310 327 #endif 311 328 if ((val & EGL_OPENVG_BIT) != 0)
Note:
See TracChangeset
for help on using the changeset viewer.