diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-05-05 13:00:47 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-05-05 13:03:05 (GMT) |
commit | 2a1eed4c718c8fa4a69351691aa466339d280126 (patch) | |
tree | 2f9abea8affbf5e8b36fde9fc852deef6f7584b4 /src | |
parent | 8806c32f45242c9d12c6799c2c762775da58b698 (diff) | |
download | Qt-2a1eed4c718c8fa4a69351691aa466339d280126.zip Qt-2a1eed4c718c8fa4a69351691aa466339d280126.tar.gz Qt-2a1eed4c718c8fa4a69351691aa466339d280126.tar.bz2 |
Fix regression in drawing parts of pixmaps on Panther.
The width of a pixmap is NOT the same as the bytes per row. We may have
been able to do that in the past, but it doesn't work in the general
case. I also took the liberty to introduce a QCFType to automatically
handling the free in the general case.
Task-number: 252176
Reviewed-by: sroedal
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpaintengine_mac.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 0644a02..5889388 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -996,15 +996,14 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co } else if (differentSize) { #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - CGImageRef img = (CGImageRef)pm.macCGHandle(); + QCFType<CGImageRef> img = pm.toMacCGImageRef(); image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height()))); - CGImageRelease(img); } else #endif { const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height()); const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm.data); - quint32 *pantherData = pmData->pixels + (sy * pm.width() + sx); + quint32 *pantherData = pmData->pixels + sy * (pmData->bytesPerRow / 4) + sx; QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, pantherData, sw*sh*pmData->bytesPerRow, 0); image = CGImageCreate(sw, sh, 8, 32, pmData->bytesPerRow, macGenericColorSpace(), |