diff options
author | Tor Arne Vestbø <torarnv@gmail.com> | 2020-03-02 16:08:05 +0100 |
---|---|---|
committer | Tor Arne Vestbø <torarnv@gmail.com> | 2020-03-04 01:30:11 +0100 |
commit | 048f0a00fa7b46f531fbe3ed6d1babae9858e8c2 (patch) | |
tree | 05b01e25bec4e2f2cc05632054df805180596d3e /src/plugins/platforms | |
parent | 5d9d3ff3269f92366b022e17485fa4dd98f5ba95 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qpaintengine_mac.mm | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 00b2267f0d..df71f76644 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -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); |