diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-02 00:31:39 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-02 00:38:57 (GMT) |
commit | f1b22116ad94472a6f24a376cf3709a272870478 (patch) | |
tree | dcff94d7efe39b2904947b144b306d1a88a0e281 /src/plugins | |
parent | ab000629fc000d5347bd7a3648afe32ae23acee5 (diff) | |
download | Qt-f1b22116ad94472a6f24a376cf3709a272870478.zip Qt-f1b22116ad94472a6f24a376cf3709a272870478.tar.gz Qt-f1b22116ad94472a6f24a376cf3709a272870478.tar.bz2 |
Fix support for 32-bit PowerVR screens with QGraphicsView
When QGLWidget was used as a viewport for QGraphicsView, it was
still treating the window surface as RGB16. Use the screen's actual
pixel format.
Also ensure that PvrEglWindowSurface::image() returns a non-null
QImage if the drawable hasn't been created yet.
Reviewed-by: trustme
Back port of 53b3a0572242d0a425e74848afba1293f195d29b
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 3698afd..afee77e 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -157,18 +157,21 @@ QImage PvrEglWindowSurface::image() const void *data = pvrQwsGetRenderBuffer(drawable); if (data) { return QImage((uchar *)data, pvrRect.width, pvrRect.height, - pvrQwsGetStride(drawable), QImage::Format_RGB16); + pvrQwsGetStride(drawable), screen->pixelFormat()); } } - return QImage(); + return QImage(16, 16, screen->pixelFormat()); } QPaintDevice *PvrEglWindowSurface::paintDevice() { - // Return a dummy paint device because the widget itself - // cannot be painted to this way. + QGLWidget *glWidget = qobject_cast<QGLWidget *>(window()); + if (glWidget) + return glWidget; + + // Should be a QGLWidget, but if not return a dummy paint device. if (!pdevice) - pdevice = new QImage(50, 50, QImage::Format_RGB16); + pdevice = new QImage(50, 50, screen->pixelFormat()); return pdevice; } |