summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qgl_mac.mm')
-rw-r--r--src/opengl/qgl_mac.mm20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index ef2fa6c..6ed07e5 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -606,10 +606,22 @@ void QGLContext::updatePaintDevice()
}
}
} else if (d->paintDevice->devType() == QInternal::Pixmap) {
- QPixmap *pm = (QPixmap *)d->paintDevice;
- PixMapHandle mac_pm = GetGWorldPixMap((GWorldPtr)pm->macQDHandle());
- aglSetOffScreen((AGLContext)d->cx, pm->width(), pm->height(),
- GetPixRowBytes(mac_pm), GetPixBaseAddr(mac_pm));
+ QPixmap *pm = reinterpret_cast<QPixmap *>(d->paintDevice);
+
+ unsigned long qdformat = k32ARGBPixelFormat;
+ if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ qdformat = k32BGRAPixelFormat;
+ Rect rect;
+ SetRect(&rect, 0, 0, pm->width(), pm->height());
+
+ GWorldPtr gworld;
+ NewGWorldFromPtr(&gworld, qdformat, &rect, 0, 0, 0,
+ reinterpret_cast<char *>(qt_mac_pixmap_get_base(pm)),
+ qt_mac_pixmap_get_bytes_per_line(pm));
+
+ PixMapHandle pixmapHandle = GetGWorldPixMap(gworld);
+ aglSetOffScreen(reinterpret_cast<AGLContext>(d->cx), pm->width(), pm->height(),
+ GetPixRowBytes(pixmapHandle), GetPixBaseAddr(pixmapHandle));
} else {
qWarning("QGLContext::updatePaintDevice(): Not sure how to render OpenGL on this device!");
}