42 #include <QtCore/qdebug.h> 43 #include <QtCore/qstringlist.h> 71 if (
props[index] == name)
72 return props[index + 1];
78 case EGL_BUFFER_SIZE:
return 0;
79 case EGL_RED_SIZE:
return 0;
80 case EGL_GREEN_SIZE:
return 0;
81 case EGL_BLUE_SIZE:
return 0;
82 case EGL_ALPHA_SIZE:
return 0;
83 #ifdef EGL_LUMINANCE_SIZE 84 case EGL_LUMINANCE_SIZE:
return 0;
86 #ifdef EGL_ALPHA_MASK_SIZE 87 case EGL_ALPHA_MASK_SIZE:
return 0;
89 #ifdef EGL_BIND_TO_TEXTURE_RGB 90 case EGL_BIND_TO_TEXTURE_RGB:
return EGL_DONT_CARE;
92 #ifdef EGL_BIND_TO_TEXTURE_RGBA 93 case EGL_BIND_TO_TEXTURE_RGBA:
return EGL_DONT_CARE;
95 #ifdef EGL_COLOR_BUFFER_TYPE 96 case EGL_COLOR_BUFFER_TYPE:
return EGL_RGB_BUFFER;
98 case EGL_CONFIG_CAVEAT:
return EGL_DONT_CARE;
99 case EGL_CONFIG_ID:
return EGL_DONT_CARE;
100 case EGL_DEPTH_SIZE:
return 0;
101 case EGL_LEVEL:
return 0;
102 case EGL_NATIVE_RENDERABLE:
return EGL_DONT_CARE;
103 case EGL_NATIVE_VISUAL_TYPE:
return EGL_DONT_CARE;
104 case EGL_MAX_SWAP_INTERVAL:
return EGL_DONT_CARE;
105 case EGL_MIN_SWAP_INTERVAL:
return EGL_DONT_CARE;
106 #ifdef EGL_RENDERABLE_TYPE 107 case EGL_RENDERABLE_TYPE:
return EGL_OPENGL_ES_BIT;
109 case EGL_SAMPLE_BUFFERS:
return 0;
110 case EGL_SAMPLES:
return 0;
111 case EGL_STENCIL_SIZE:
return 0;
112 case EGL_SURFACE_TYPE:
return EGL_WINDOW_BIT;
113 case EGL_TRANSPARENT_TYPE:
return EGL_NONE;
114 case EGL_TRANSPARENT_RED_VALUE:
return EGL_DONT_CARE;
115 case EGL_TRANSPARENT_GREEN_VALUE:
return EGL_DONT_CARE;
116 case EGL_TRANSPARENT_BLUE_VALUE:
return EGL_DONT_CARE;
118 #ifdef EGL_VERSION_1_3 119 case EGL_CONFORMANT:
return 0;
120 case EGL_MATCH_NATIVE_PIXMAP:
return EGL_NONE;
123 case EGL_MAX_PBUFFER_HEIGHT:
124 case EGL_MAX_PBUFFER_WIDTH:
125 case EGL_MAX_PBUFFER_PIXELS:
126 case EGL_NATIVE_VISUAL_ID:
129 return EGL_DONT_CARE;
132 return EGL_DONT_CARE;
141 if (
props[index] == name) {
155 if (
props[index] == name) {
170 setValue(EGL_SURFACE_TYPE, EGL_PIXMAP_BIT);
172 setValue(EGL_SURFACE_TYPE, EGL_PBUFFER_BIT);
174 setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
183 switch (pixelFormat) {
186 red = green = blue = 8; alpha = 0;
break;
189 red = green = blue = alpha = 8;
break;
191 red = 5; green = 6; blue = 5; alpha = 0;
break;
193 red = 5; green = 6; blue = 5; alpha = 8;
break;
195 red = green = blue = 6; alpha = 0;
break;
197 red = green = blue = alpha = 6;
break;
199 red = green = blue = 5; alpha = 0;
break;
201 red = green = blue = 5; alpha = 8;
break;
203 red = green = blue = 4; alpha = 0;
break;
205 red = green = blue = alpha = 4;
break;
207 qWarning() <<
"QEglProperties::setPixelFormat(): Unsupported pixel format";
208 red = green = blue = alpha = 1;
break;
218 #ifdef EGL_RENDERABLE_TYPE 219 #if defined(QT_OPENGL_ES_2) 221 setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
222 #elif defined(QT_OPENGL_ES) 224 setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
225 #elif defined(EGL_OPENGL_BIT) 227 setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
229 #ifdef EGL_OPENVG_BIT 231 setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT);
244 #ifdef EGL_SWAP_BEHAVIOR 245 if (
value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE)
249 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 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);
264 if (
value(EGL_BUFFER_SIZE) == 16) {
273 #if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB) 283 #ifdef EGL_BIND_TO_TEXTURE_RGB 295 if ((str.
length() - lastnl) >= 50)
306 val =
value(EGL_CONFIG_ID);
307 if (val != EGL_DONT_CARE) {
313 #ifdef EGL_RENDERABLE_TYPE 314 val =
value(EGL_RENDERABLE_TYPE);
315 if (val != EGL_DONT_CARE) {
318 if ((val & EGL_OPENGL_ES_BIT) != 0)
320 #ifdef EGL_OPENGL_ES2_BIT 321 if ((val & EGL_OPENGL_ES2_BIT) != 0)
324 #ifdef EGL_OPENGL_BIT 325 if ((val & EGL_OPENGL_BIT) != 0)
328 if ((val & EGL_OPENVG_BIT) != 0)
343 int alpha =
value(EGL_ALPHA_SIZE);
344 int bufferSize =
value(EGL_BUFFER_SIZE);
345 if (bufferSize == (red + green + blue + alpha))
355 if (bufferSize != 0) {
361 #ifdef EGL_COLOR_BUFFER_TYPE 362 val =
value(EGL_COLOR_BUFFER_TYPE);
363 if (val == EGL_LUMINANCE_BUFFER) {
365 }
else if (val != EGL_DONT_CARE && val != EGL_RGB_BUFFER) {
371 val =
value(EGL_DEPTH_SIZE);
377 val =
value(EGL_STENCIL_SIZE);
383 val =
value(EGL_SURFACE_TYPE);
384 if (val != EGL_DONT_CARE) {
387 if ((val & EGL_WINDOW_BIT) != 0)
389 if ((val & EGL_PIXMAP_BIT) != 0)
391 if ((val & EGL_PBUFFER_BIT) != 0)
393 #ifdef EGL_VG_COLORSPACE_LINEAR_BIT 394 if ((val & EGL_VG_COLORSPACE_LINEAR_BIT) != 0)
397 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 398 if ((val & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
401 if ((val & ~(EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT
402 #ifdef EGL_VG_COLORSPACE_LINEAR_BIT
403 | EGL_VG_COLORSPACE_LINEAR_BIT
405 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
406 | EGL_VG_ALPHA_FORMAT_PRE_BIT
414 val =
value(EGL_CONFIG_CAVEAT);
415 if (val != EGL_DONT_CARE) {
419 else if (val == EGL_SLOW_CONFIG)
421 else if (val == EGL_NON_CONFORMANT_CONFIG)
427 val =
value(EGL_LEVEL);
434 width =
value(EGL_MAX_PBUFFER_WIDTH);
435 height =
value(EGL_MAX_PBUFFER_HEIGHT);
436 pixels =
value(EGL_MAX_PBUFFER_PIXELS);
437 if (height != EGL_DONT_CARE || width != EGL_DONT_CARE) {
442 if (pixels != (width * height)) {
448 val =
value(EGL_NATIVE_RENDERABLE);
449 if (val != EGL_DONT_CARE) {
456 val =
value(EGL_NATIVE_VISUAL_ID);
457 if (val != EGL_DONT_CARE) {
462 val =
value(EGL_NATIVE_VISUAL_TYPE);
463 if (val != EGL_DONT_CARE) {
468 #ifdef EGL_PRESERVED_RESOURCES 469 val =
value(EGL_PRESERVED_RESOURCES);
470 if (val != EGL_DONT_CARE) {
478 val =
value(EGL_SAMPLES);
484 val =
value(EGL_SAMPLE_BUFFERS);
490 val =
value(EGL_TRANSPARENT_TYPE);
491 if (val == EGL_TRANSPARENT_RGB) {
500 #if defined(EGL_BIND_TO_TEXTURE_RGB) && defined(EGL_BIND_TO_TEXTURE_RGBA) 501 val =
value(EGL_BIND_TO_TEXTURE_RGB);
502 int val2 =
value(EGL_BIND_TO_TEXTURE_RGBA);
503 if (val != EGL_DONT_CARE || val2 != EGL_DONT_CARE) {
509 if (val2 == EGL_TRUE)
516 #ifdef EGL_MIN_SWAP_INTERVAL 517 val =
value(EGL_MIN_SWAP_INTERVAL);
518 if (val != EGL_DONT_CARE) {
524 #ifdef EGL_MIN_SWAP_INTERVAL 525 val =
value(EGL_MAX_SWAP_INTERVAL);
526 if (val != EGL_DONT_CARE) {
532 #ifdef EGL_LUMINANCE_SIZE 533 val =
value(EGL_LUMINANCE_SIZE);
540 #ifdef EGL_ALPHA_MASK_SIZE 541 val =
value(EGL_ALPHA_MASK_SIZE);
548 #ifdef EGL_CONFORMANT 549 val =
value(EGL_CONFORMANT);
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Format
The following image formats are available in Qt.
#define QT_END_NAMESPACE
This macro expands to.
bool removeValue(int name)
int length() const
Returns the number of characters in this string.
int value(int name) const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
void setValue(int name, int value)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT EGLDisplay display()
void setRenderableType(QEgl::API api)
The QStringList class provides a list of strings.
Q_CORE_EXPORT void qWarning(const char *,...)
bool reduceConfiguration()
#define TRUE
Synonym for true.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
QVarLengthArray< EGLint > props
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void setPixelFormat(QImage::Format pixelFormat)
static void addTag(QString &str, const QString &tag)
void setDeviceType(int devType)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.