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:31:39 (GMT) |
commit | 53b3a0572242d0a425e74848afba1293f195d29b (patch) | |
tree | 753913891848f2b93f4c2834506ad994edef5819 /src/plugins | |
parent | 6ca9ba3b67695e18c1c57176d5d8849547517199 (diff) | |
download | Qt-53b3a0572242d0a425e74848afba1293f195d29b.zip Qt-53b3a0572242d0a425e74848afba1293f195d29b.tar.gz Qt-53b3a0572242d0a425e74848afba1293f195d29b.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
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; } |