From: Jiang Jiang Date: Wed, 11 May 2011 14:56:24 +0000 (+0200) Subject: Fix QGLWidget::renderPixmap for raster engine on Mac X-Git-Tag: qt-v5.0.0-alpha1~4262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=635af8d700087b24bd8c212b14cf644e0f71a6fc;p=profile%2Fivi%2Fqtbase.git Fix QGLWidget::renderPixmap for raster engine on Mac The QPixmap buffer is backed by QRasterPixmapData instead of QMacPixmapData for the raster engine, thus we have to update qt_mac_pixmap_get_base() and qt_mac_pixmap_get_bytes_per_line(), so that QGLWidget can locate the offscreen buffer from a QPixmap. Reviewed-by: Fabien Freling (cherry picked from commit c5846314dfd80e7f7f32ba737f1884dcccbbd80d) Change-Id: I2414222f8a59e02c778177d52ad9a6e0ff68668d Reviewed-on: http://codereview.qt.nokia.com/123 Reviewed-by: Jiang Jiang --- diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 7e31f5b..cb30161 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -73,12 +74,18 @@ static int qt_pixmap_serial = 0; Q_GUI_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix) { - return static_cast(pix->data.data())->pixels; + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) + return reinterpret_cast(static_cast(pix->data.data())->buffer()->bits()); + else + return static_cast(pix->data.data())->pixels; } Q_GUI_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix) { - return static_cast(pix->data.data())->bytesPerRow; + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) + return static_cast(pix->data.data())->buffer()->bytesPerLine(); + else + return static_cast(pix->data.data())->bytesPerRow; } void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t)