summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_mac.cpp
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-05-11 14:56:24 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-05-11 15:08:07 (GMT)
commitc5846314dfd80e7f7f32ba737f1884dcccbbd80d (patch)
treef7e2dd74463c0e2de5f853c2687311d9071f0b47 /src/gui/image/qpixmap_mac.cpp
parent4d2edca95edbb93fb7c79c4ddb19e12cc4416ff2 (diff)
downloadQt-c5846314dfd80e7f7f32ba737f1884dcccbbd80d.zip
Qt-c5846314dfd80e7f7f32ba737f1884dcccbbd80d.tar.gz
Qt-c5846314dfd80e7f7f32ba737f1884dcccbbd80d.tar.bz2
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
Diffstat (limited to 'src/gui/image/qpixmap_mac.cpp')
-rw-r--r--src/gui/image/qpixmap_mac.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index 72e2aa6..e107d88 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -54,6 +54,7 @@
#include <private/qpaintengine_mac_p.h>
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
+#include <private/qapplication_p.h>
#include <limits.h>
#include <string.h>
@@ -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<QMacPixmapData*>(pix->data.data())->pixels;
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+ return reinterpret_cast<quint32 *>(static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bits());
+ else
+ return static_cast<QMacPixmapData*>(pix->data.data())->pixels;
}
Q_GUI_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix)
{
- return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow;
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+ return static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bytesPerLine();
+ else
+ return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow;
}
void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t)