vcl/inc/quartz/salgdi.h | 2 +- vcl/osx/salprn.cxx | 2 +- vcl/quartz/salgdi.cxx | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-)
New commits: commit 73de244aecd985d049da3be49e52cbeeb3b77a8e Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Wed Dec 7 14:24:57 2022 -0500 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 9 14:48:19 2022 +0000 tdf#146842 Do not use Skia for printing Skia does not work with a native print graphics contexts. I am not sure why but from what I can see, the Skia implementation drawing to a bitmap buffer. However, in an NSPrintOperation, the print view's backing buffer is CGPDFContext so even if this bug could be solved by blitting the Skia bitmap buffer, the printed PDF would not have selectable text so always disable Skia for print graphics contexts. Change-Id: I214ba83b6e368af3ef51ea770b093612d04047a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143798 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit de3f13e2175564316eb5a62dee65e9ff8f31b460) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143857 diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 569a14a6d3fc..ca1438270eca 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -464,7 +464,7 @@ class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl rtl::Reference<CoreTextStyle> mpTextStyle[MAX_FALLBACK]; public: - AquaSalGraphics(); + AquaSalGraphics(bool bPrinter = false); virtual ~AquaSalGraphics() override; void SetVirDevGraphics(SalVirtualDevice* pVirDev,CGLayerHolder const &rLayer, CGContextRef, int nBitDepth = 0); diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index bec30a35b562..e9101e390085 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -71,7 +71,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : [mpPrintInfo setOrientation: NSPaperOrientationPortrait]; } - mpGraphics = new AquaSalGraphics(); + mpGraphics = new AquaSalGraphics(true); const int nWidth = 100, nHeight = 100; mpContextMemory.reset(new (std::nothrow) sal_uInt8[nWidth * 4 * nHeight]); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 1ce488be9c4d..d4ecc85ccfb4 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -211,14 +211,21 @@ bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit return rFontCapabilities.oUnicodeRange || rFontCapabilities.oCodePageRange; } -AquaSalGraphics::AquaSalGraphics() +AquaSalGraphics::AquaSalGraphics(bool bPrinter) : mnRealDPIX( 0 ) , mnRealDPIY( 0 ) { SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this ); #if HAVE_FEATURE_SKIA - if(SkiaHelper::isVCLSkiaEnabled()) + // tdf#146842 Do not use Skia for printing + // Skia does not work with a native print graphics contexts. I am not sure + // why but from what I can see, the Skia implementation drawing to a bitmap + // buffer. However, in an NSPrintOperation, the print view's backing buffer + // is CGPDFContext so even if this bug could be solved by blitting the + // Skia bitmap buffer, the printed PDF would not have selectable text so + // always disable Skia for print graphics contexts. + if(!bPrinter && SkiaHelper::isVCLSkiaEnabled()) mpBackend.reset(new AquaSkiaSalGraphicsImpl(*this, maShared)); #else if(false)