summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qpaintengine_mac.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-12-10 10:02:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-25 16:00:03 +0100
commitf2ade01f4c0c33e070d89b473b4c0037aed9e7f3 (patch)
tree62c12f156c5d3aefed089a24e7dbcc45f34443e9 /src/plugins/platforms/cocoa/qpaintengine_mac.mm
parent51572d3d8f85f8836c25d1f793e69b170672cc3c (diff)
Cocoa: QImage -> CGImage conversion cleanup
Move to one qt_mac_toCGImage function that has simple semantics and properly retains a copy of the QImage for the lifetime of the CGImage. Remove the old qt_mac_toCGImage function which had two problems: 1) It would not retain the QImage data (this was probably ok for its original use case: creating short-lived CGImages for the paint engine) 2) It had acquired a somewhat odd **datacopy out parameter for the cases where you _do_ want to retain the image data. This makes the exported image conversion function from QtMacExtras work: The CGImages it creates will no longer reference free'd memory once the QImage is deleted. Change-Id: I583040d16aefb17fc3d801d6b047a0b2a76c7f74 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qpaintengine_mac.mm')
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 40d60a6a0a..61fbe3a61f 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -488,7 +488,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
if (isBitmap)
pat->image = qt_mac_create_imagemask(pat->data.pixmap, pat->data.pixmap.rect());
else
- pat->image = qt_mac_image_to_cgimage(pat->data.pixmap.toImage());
+ pat->image = qt_mac_toCGImage(pat->data.pixmap.toImage());
}
} else {
w = CGImageGetWidth(pat->image);
@@ -963,11 +963,11 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co
CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev));
image = qt_mac_create_imagemask(pm, sr);
} else if (differentSize) {
- QCFType<CGImageRef> img = qt_mac_image_to_cgimage(pm.toImage());
+ QCFType<CGImageRef> img = qt_mac_toCGImage(pm.toImage());
if (img)
image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
} else {
- image = qt_mac_image_to_cgimage(pm.toImage());
+ image = qt_mac_toCGImage(pm.toImage());
}
qt_mac_drawCGImage(d->hd, &rect, image);
if (doRestore)