Changeset 769 for trunk/src/openvg/qwindowsurface_vgegl.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/openvg/qwindowsurface_vgegl.cpp
r651 r769 178 178 } else { 179 179 QVGSharedContext *shared = sharedContext(); 180 shared->firstPixmap = pd->next; 180 if (shared) 181 shared->firstPixmap = pd->next; 181 182 } 182 183 } … … 226 227 context = new QEglContext(); 227 228 context->setApi(QEgl::OpenVG); 228 if (!context->openDisplay(device)) {229 delete context;230 return 0;231 }232 229 233 230 // Set the swap interval for the display. 234 231 QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); 235 232 if (!interval.isEmpty()) 236 eglSwapInterval( context->display(), interval.toInt());233 eglSwapInterval(QEglContext::display(), interval.toInt()); 237 234 else 238 eglSwapInterval( context->display(), 1);235 eglSwapInterval(QEglContext::display(), 1); 239 236 240 237 #ifdef EGL_RENDERABLE_TYPE … … 250 247 EGLConfig cfg; 251 248 if (eglChooseConfig 252 ( context->display(), properties, &cfg, 1, &matching) &&249 (QEglContext::display(), properties, &cfg, 1, &matching) && 253 250 matching > 0) { 254 251 // Check that the selected configuration actually supports OpenVG … … 257 254 EGLint type = 0; 258 255 eglGetConfigAttrib 259 ( context->display(), cfg, EGL_CONFIG_ID, &id);256 (QEglContext::display(), cfg, EGL_CONFIG_ID, &id); 260 257 eglGetConfigAttrib 261 ( context->display(), cfg, EGL_RENDERABLE_TYPE, &type);258 (QEglContext::display(), cfg, EGL_RENDERABLE_TYPE, &type); 262 259 if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) { 263 260 context->setConfig(cfg); … … 338 335 shared->context->doneCurrent(); 339 336 if (shared->surface != EGL_NO_SURFACE) { 340 eglDestroySurface( shared->context->display(), shared->surface);337 eglDestroySurface(QEglContext::display(), shared->surface); 341 338 shared->surface = EGL_NO_SURFACE; 342 339 } … … 416 413 } 417 414 shared->surface = eglCreatePbufferSurface 418 ( shared->context->display(), shared->context->config(), attribs);415 (QEglContext::display(), shared->context->config(), attribs); 419 416 } 420 417 return shared->surface; … … 559 556 recreateBackBuffer = false; 560 557 if (backBufferSurface != EGL_NO_SURFACE) { 561 eglDestroySurface( context->display(), backBufferSurface);558 eglDestroySurface(QEglContext::display(), backBufferSurface); 562 559 backBufferSurface = EGL_NO_SURFACE; 563 560 } … … 572 569 // Create an EGL surface for rendering into the VGImage. 573 570 backBufferSurface = eglCreatePbufferFromClientBuffer 574 ( context->display(), EGL_OPENVG_IMAGE,571 (QEglContext::display(), EGL_OPENVG_IMAGE, 575 572 (EGLClientBuffer)(backBuffer), 576 573 context->config(), NULL); … … 663 660 windowSurface = context->createSurface(widget, &surfaceProps); 664 661 isPaintingActive = false; 662 needToSwap = true; 665 663 } 666 664 #else … … 708 706 // Did we get a direct to window rendering surface? 709 707 EGLint buffer = 0; 710 if (eglQueryContext( context->display(), context->context(),708 if (eglQueryContext(QEglContext::display(), context->context(), 711 709 EGL_RENDER_BUFFER, &buffer) && 712 710 buffer == EGL_SINGLE_BUFFER) { … … 714 712 } 715 713 #endif 716 #if !defined(QVG_NO_PRESERVED_SWAP)717 // Try to force the surface back buffer to preserve its contents.718 if (needToSwap) {719 eglGetError(); // Clear error state first.720 eglSurfaceAttrib(context->display(), surface,721 EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);722 if (eglGetError() != EGL_SUCCESS) {723 qWarning("QVG: could not enable preserved swap");724 }725 }726 #endif727 714 windowSurface = surface; 728 715 isPaintingActive = false; 729 716 } 717 718 #if !defined(QVG_NO_PRESERVED_SWAP) 719 // Try to force the surface back buffer to preserve its contents. 720 if (needToSwap) { 721 eglGetError(); // Clear error state first. 722 eglSurfaceAttrib(QEglContext::display(), windowSurface, 723 EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); 724 if (eglGetError() != EGL_SUCCESS) { 725 qWarning("QVG: could not enable preserved swap"); 726 } 727 } 728 #endif 730 729 return context; 731 730 } … … 760 759 } 761 760 761 bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const 762 { 763 #if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP) 764 return true; 765 #else 766 return QVGEGLWindowSurfacePrivate::supportsStaticContents(); 767 #endif 768 } 769 770 bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy) 771 { 772 #ifdef QVG_BUFFER_SCROLLING 773 QEglContext *context = ensureContext(widget); 774 if (context) { 775 context->makeCurrent(windowSurface); 776 QRect scrollRect = area.boundingRect(); 777 int sx = scrollRect.x(); 778 int sy = size.height() - scrollRect.y() - scrollRect.height(); 779 vgSeti(VG_SCISSORING, VG_FALSE); 780 vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height()); 781 context->lazyDoneCurrent(); 782 return true; 783 } 784 #endif 785 return false; 786 } 787 762 788 QT_END_NAMESPACE 763 789
Note:
See TracChangeset
for help on using the changeset viewer.