Changeset 846 for trunk/src/openvg/qwindowsurface_vgegl.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/openvg/qwindowsurface_vgegl.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 72 72 QImage::Format qt_vg_config_to_image_format(QEglContext *context) 73 73 { 74 EGLint red = 0; 75 EGLint green = 0; 76 EGLint blue = 0; 77 EGLint alpha = 0; 78 context->configAttrib(EGL_RED_SIZE, &red); 79 context->configAttrib(EGL_GREEN_SIZE, &green); 80 context->configAttrib(EGL_BLUE_SIZE, &blue); 81 context->configAttrib(EGL_ALPHA_SIZE, &alpha); 74 EGLint red = context->configAttrib(EGL_RED_SIZE); 75 EGLint green = context->configAttrib(EGL_GREEN_SIZE); 76 EGLint blue = context->configAttrib(EGL_BLUE_SIZE); 77 EGLint alpha = context->configAttrib(EGL_ALPHA_SIZE); 82 78 QImage::Format argbFormat; 83 79 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 84 EGLint type = 0; 85 context->configAttrib(EGL_SURFACE_TYPE, &type); 80 EGLint type = context->configAttrib(EGL_SURFACE_TYPE); 86 81 if ((type & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0) 87 82 argbFormat = QImage::Format_ARGB32_Premultiplied; … … 211 206 static bool isPremultipliedContext(const QEglContext *context) 212 207 { 213 EGLint value = 0; 214 if (context->configAttrib(EGL_SURFACE_TYPE, &value)) 215 return (value & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0; 216 else 217 return false; 208 return context->configAttrib(EGL_SURFACE_TYPE) & EGL_VG_ALPHA_FORMAT_PRE_BIT; 218 209 } 219 210 … … 231 222 QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); 232 223 if (!interval.isEmpty()) 233 eglSwapInterval(QEgl Context::display(), interval.toInt());224 eglSwapInterval(QEgl::display(), interval.toInt()); 234 225 else 235 eglSwapInterval(QEgl Context::display(), 1);226 eglSwapInterval(QEgl::display(), 1); 236 227 237 228 #ifdef EGL_RENDERABLE_TYPE … … 247 238 EGLConfig cfg; 248 239 if (eglChooseConfig 249 (QEgl Context::display(), properties, &cfg, 1, &matching) &&240 (QEgl::display(), properties, &cfg, 1, &matching) && 250 241 matching > 0) { 251 242 // Check that the selected configuration actually supports OpenVG … … 254 245 EGLint type = 0; 255 246 eglGetConfigAttrib 256 (QEgl Context::display(), cfg, EGL_CONFIG_ID, &id);247 (QEgl::display(), cfg, EGL_CONFIG_ID, &id); 257 248 eglGetConfigAttrib 258 (QEgl Context::display(), cfg, EGL_RENDERABLE_TYPE, &type);249 (QEgl::display(), cfg, EGL_RENDERABLE_TYPE, &type); 259 250 if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) { 260 251 context->setConfig(cfg); … … 277 268 if (redSize == EGL_DONT_CARE || redSize == 0) 278 269 configProps.setPixelFormat(QImage::Format_ARGB32); // XXX 279 #ifndef QVG_SCISSOR_CLIP280 // If we are using the mask to clip, then explicitly request a mask.281 270 configProps.setValue(EGL_ALPHA_MASK_SIZE, 1); 282 #endif283 271 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 284 272 configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | … … 335 323 shared->context->doneCurrent(); 336 324 if (shared->surface != EGL_NO_SURFACE) { 337 eglDestroySurface(QEgl Context::display(), shared->surface);325 eglDestroySurface(QEgl::display(), shared->surface); 338 326 shared->surface = EGL_NO_SURFACE; 339 327 } … … 413 401 } 414 402 shared->surface = eglCreatePbufferSurface 415 (QEgl Context::display(), shared->context->config(), attribs);403 (QEgl::display(), shared->context->config(), attribs); 416 404 } 417 405 return shared->surface; … … 556 544 recreateBackBuffer = false; 557 545 if (backBufferSurface != EGL_NO_SURFACE) { 558 eglDestroySurface(QEgl Context::display(), backBufferSurface);546 eglDestroySurface(QEgl::display(), backBufferSurface); 559 547 backBufferSurface = EGL_NO_SURFACE; 560 548 } … … 569 557 // Create an EGL surface for rendering into the VGImage. 570 558 backBufferSurface = eglCreatePbufferFromClientBuffer 571 (QEgl Context::display(), EGL_OPENVG_IMAGE,559 (QEgl::display(), EGL_OPENVG_IMAGE, 572 560 (EGLClientBuffer)(backBuffer), 573 561 context->config(), NULL); … … 706 694 // Did we get a direct to window rendering surface? 707 695 EGLint buffer = 0; 708 if (eglQueryContext(QEgl Context::display(), context->context(),696 if (eglQueryContext(QEgl::display(), context->context(), 709 697 EGL_RENDER_BUFFER, &buffer) && 710 698 buffer == EGL_SINGLE_BUFFER) { … … 719 707 // Try to force the surface back buffer to preserve its contents. 720 708 if (needToSwap) { 721 eglGetError(); // Clear error state first. 722 eglSurfaceAttrib(QEglContext::display(), windowSurface, 709 bool succeeded = eglSurfaceAttrib(QEgl::display(), windowSurface, 723 710 EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); 724 if ( eglGetError() != EGL_SUCCESS) {711 if (eglGetError() != EGL_SUCCESS) { 725 712 qWarning("QVG: could not enable preserved swap"); 726 713 }
Note:
See TracChangeset
for help on using the changeset viewer.