macOS: Don't create QMacCGContext when printing

We adopt the context of the print session, so the code is not needed,
and would just produce a warning since QMacCGContext didn't know what
to do about the printer paint device.

Change-Id: I9ac079f5cb5d98022045632592d0e375710eecc3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-03-02 16:08:05 +01:00
parent 5d9d3ff326
commit 048f0a00fa

View File

@ -394,16 +394,19 @@ QCoreGraphicsPaintEngine::begin(QPaintDevice *pdev)
d->cosmeticPenSize = 1;
d->current.clipEnabled = false;
d->pixelSize = QPoint(1,1);
QMacCGContext ctx(pdev);
d->hd = CGContextRetain(ctx);
if (d->hd) {
d->saveGraphicsState();
d->orig_xform = CGContextGetCTM(d->hd);
if (d->shading) {
CGShadingRelease(d->shading);
d->shading = nullptr;
if (pdev->devType() != QInternal::Printer) {
QMacCGContext ctx(pdev);
d->hd = CGContextRetain(ctx);
if (d->hd) {
d->saveGraphicsState();
d->orig_xform = CGContextGetCTM(d->hd);
if (d->shading) {
CGShadingRelease(d->shading);
d->shading = nullptr;
}
d->setClip(nullptr); //clear the context's clipping
}
d->setClip(nullptr); //clear the context's clipping
}
setActive(true);