Changeset 561 for trunk/src/opengl/qglpixelbuffer.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/opengl/qglpixelbuffer.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtOpenGL module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 \since 4.1 46 46 47 \ingroup multimedia47 \ingroup painting-3D 48 48 49 49 Rendering into a pbuffer is normally done using full hardware … … 77 77 */ 78 78 79 #include <QtCore/qglobal.h> 80 81 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) 82 #include <private/qpaintengineex_opengl2_p.h> 83 #endif 79 84 80 85 #include <qglpixelbuffer.h> … … 82 87 #include <qimage.h> 83 88 84 #if !defined(QT_OPENGL_ES_2)89 #ifndef QT_OPENGL_ES_2 85 90 #include <private/qpaintengine_opengl_p.h> 86 91 #endif … … 95 100 96 101 extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); 102 103 104 QGLContext* QGLPBufferGLPaintDevice::context() const 105 { 106 return pbuf->d_func()->qctx; 107 } 108 109 void QGLPBufferGLPaintDevice::endPaint() { 110 glFlush(); 111 QGLPaintDevice::endPaint(); 112 } 113 114 void QGLPBufferGLPaintDevice::setPBuffer(QGLPixelBuffer* pb) 115 { 116 pbuf = pb; 117 } 97 118 98 119 void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &format, QGLWidget *shareWidget) … … 106 127 qctx = new QGLContext(format); 107 128 qctx->d_func()->sharing = (shareWidget != 0); 108 if (shareWidget != 0 && shareWidget->d_func()->glcx) 129 if (shareWidget != 0 && shareWidget->d_func()->glcx) { 109 130 qgl_share_reg()->addShare(qctx, shareWidget->d_func()->glcx); 110 131 shareWidget->d_func()->glcx->d_func()->sharing = true; 132 } 133 134 glDevice.setPBuffer(q); 111 135 qctx->d_func()->paintDevice = q; 112 136 qctx->d_func()->valid = true; … … 123 147 #elif defined(QT_OPENGL_ES) 124 148 qctx->d_func()->eglContext = ctx; 149 qctx->d_func()->eglSurface = pbuf; 125 150 #endif 126 151 } … … 187 212 if (current && current != d->qctx) 188 213 current->makeCurrent(); 189 delete d_ptr;190 214 } 191 215 … … 364 388 } 365 389 366 #if !defined(QT_OPENGL_ES_2) 367 Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_paintengine) 390 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) 391 Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) 392 #endif 393 394 #ifndef QT_OPENGL_ES_2 395 Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) 368 396 #endif 369 397 … … 371 399 QPaintEngine *QGLPixelBuffer::paintEngine() const 372 400 { 373 #if !defined(QT_OPENGL_ES_2) 374 return qt_buffer_paintengine(); 401 #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) 402 return qt_buffer_engine(); 403 #elif defined(QT_OPENGL_ES_2) 404 return qt_buffer_2_engine(); 375 405 #else 376 return 0; 377 #endif 378 } 379 380 extern int qt_defaultDpi(); 406 if (qt_gl_preferGL2Engine()) 407 return qt_buffer_2_engine(); 408 else 409 return qt_buffer_engine(); 410 #endif 411 } 412 413 extern int qt_defaultDpiX(); 414 extern int qt_defaultDpiY(); 381 415 382 416 /*! \reimp */ … … 385 419 Q_D(const QGLPixelBuffer); 386 420 387 float dpmx = qt_defaultDpi ()*100./2.54;388 float dpmy = qt_defaultDpi ()*100./2.54;421 float dpmx = qt_defaultDpiX()*100./2.54; 422 float dpmy = qt_defaultDpiY()*100./2.54; 389 423 int w = d->req_size.width(); 390 424 int h = d->req_size.height(); … … 409 443 410 444 case PdmDpiX: 411 return (int)(dpmx * 0.0254);445 return qRound(dpmx * 0.0254); 412 446 413 447 case PdmDpiY: 414 return (int)(dpmy * 0.0254);448 return qRound(dpmy * 0.0254); 415 449 416 450 case PdmPhysicalDpiX: 417 return (int)(dpmx * 0.0254);451 return qRound(dpmx * 0.0254); 418 452 419 453 case PdmPhysicalDpiY: 420 return (int)(dpmy * 0.0254);454 return qRound(dpmy * 0.0254); 421 455 422 456 default: … … 577 611 578 612 /*! \fn int QGLPixelBuffer::devType() const 579 \ reimp613 \internal 580 614 */ 581 615
Note:
See TracChangeset
for help on using the changeset viewer.