[Libreoffice-commits] core.git: vcl/osx vcl/quartz

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Nov 3 18:35:41 UTC 2018


 vcl/osx/salinst.cxx        |    4 +++-
 vcl/osx/salprn.cxx         |    4 +++-
 vcl/quartz/salgdiutils.cxx |    8 ++++++--
 vcl/quartz/salvd.cxx       |    4 +++-
 4 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 074b2e327021c0a65fedf2fe9d327029c8be7a45
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Nov 3 18:27:36 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Nov 3 19:35:07 2018 +0100

    Still use 'graphicsPort', even if deprecated in macOS 10.14
    
    ...macOS 10.9 reportedly doesn't yet support the 'CGContext' replacement, see
    the comments to <https://gerrit.libreoffice.org/#/c/61353/>
    "loplugin:redundantcast".
    
    This reverts c3c88d6bbe4109fcf1a6d53e947faec775c96e42 "loplugin:redundantcast"
    (whose commit message was rather misleading; the redundantcast warnings were
    merely a follow-up to the commit's actual meat, of replacing deprecated uses of
    'graphicsPort' with 'CGContext'; I had failed to realize that when I chunked the
    various changes necessary for 10.14 into several individual commits) and adds
    SAL_WNODEPRECATED_DECLARATIONS_PUSH/POP instead.
    
    Change-Id: I778d7c3a29c780beff561fbbcc38df9e1494114c
    Reviewed-on: https://gerrit.libreoffice.org/62815
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 7886f8efa129..b3797c958f4d 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -948,7 +948,9 @@ NSImage* CreateNSImage( const Image& rImage )
     {
         [pImage lockFocusFlipped:YES];
         NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
-        CGContextRef rCGContext = [pContext CGContext];
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
+        CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
+SAL_WNODEPRECATED_DECLARATIONS_POP
 
         const CGRect aDstRect = { {0, 0}, { static_cast<CGFloat>(aSize.Width()), static_cast<CGFloat>(aSize.Height()) } };
         CGContextDrawImage( rCGContext, aDstRect, xImage );
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 34f8cbb60e26..d8498ff6a364 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -547,7 +547,9 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_b
     if( i_bNewJobData && i_pSetupData )
         SetPrinterData( i_pSetupData );
 
-    CGContextRef rContext = [[NSGraphicsContext currentContext] CGContext];
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
+    CGContextRef rContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+SAL_WNODEPRECATED_DECLARATIONS_POP
 
     SetupPrinterGraphics( rContext );
 
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 22a2ad041f65..6ef9a2430c29 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -118,7 +118,9 @@ bool AquaSalGraphics::CheckContext()
         {
             const CGSize aLayerSize = { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) };
             NSGraphicsContext* pNSGContext = [NSGraphicsContext graphicsContextWithWindow: mpFrame->getNSWindow()];
-            CGContextRef xCGContext = [pNSGContext CGContext];
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
+            CGContextRef xCGContext = static_cast<CGContextRef>([pNSGContext graphicsPort]);
+SAL_WNODEPRECATED_DECLARATIONS_POP
             mxLayer = CGLayerCreateWithContext( xCGContext, aLayerSize, nullptr );
             SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << xCGContext << "," << aLayerSize << ",NULL) = " << mxLayer );
             if( mxLayer )
@@ -192,7 +194,9 @@ void AquaSalGraphics::UpdateWindow( NSRect& )
     NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
     if( (mxLayer != nullptr) && (pContext != nullptr) )
     {
-        CGContextRef rCGContext = [pContext CGContext];
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
+        CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
+SAL_WNODEPRECATED_DECLARATIONS_POP
         SAL_INFO( "vcl.cg", "[[NSGraphicsContext currentContext] graphicsPort] = " << rCGContext );
 
         CGMutablePathRef rClip = mpFrame->getClipPath();
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index d752a2d84acf..333276678b57 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -264,7 +264,9 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
                 NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pNSWindow];
                 if( pNSContext )
                 {
-                    xCGContext = [pNSContext CGContext];
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
+                    xCGContext = static_cast<CGContextRef>([pNSContext graphicsPort]);
+SAL_WNODEPRECATED_DECLARATIONS_POP
                 }
             }
             // At least on macOS 10.14 during CppunitTests (that have hidden windows), it happens


More information about the Libreoffice-commits mailing list