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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 11 18:36:51 UTC 2018


 vcl/osx/salinst.cxx        |    4 +---
 vcl/osx/salprn.cxx         |    4 +---
 vcl/quartz/salgdiutils.cxx |   10 +++-------
 vcl/quartz/salvd.cxx       |    4 +---
 4 files changed, 6 insertions(+), 16 deletions(-)

New commits:
commit 311490855235a85bceb05e6009d3c37f79b3bc2a
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Dec 11 20:12:18 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Dec 11 20:34:28 2018 +0200

    Do as the docs say: Use the CGContext property instead of graphicsPort
    
    The graphicsPort property of NSGraphicsContext is deprecated in 10.14.
    CGContext is there since 10.10 so we can use it unconditionally.
    
    But sadly this did not enable me to un-comment the assert() a few
    lines below.
    
    Wonder if this deprecation is just a cleanup of the API, and
    functionality-wise the CGContext property is exactly the same as
    graphicsPort?
    
    Change-Id: I2d5d0c766c343faa2d8cabea3a0729ce5b3a34e3

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index f58f0e43e893..6c2ca65c3050 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -950,9 +950,7 @@ NSImage* CreateNSImage( const Image& rImage )
     {
         [pImage lockFocusFlipped:YES];
         NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
-SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
-        CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
-SAL_WNODEPRECATED_DECLARATIONS_POP
+        CGContextRef rCGContext = [pContext CGContext];
 
         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 4f1981b146ec..27c6735d5c7b 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -549,9 +549,7 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_b
     if( i_bNewJobData && i_pSetupData )
         SetPrinterData( i_pSetupData );
 
-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
+    CGContextRef rContext = [[NSGraphicsContext currentContext] CGContext];
 
     SetupPrinterGraphics( rContext );
 
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 2218d3e936a4..30c5755d1efd 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -124,9 +124,7 @@ bool AquaSalGraphics::CheckContext()
             {
                 const CGSize aLayerSize = { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) };
                 NSGraphicsContext* pNSGContext = [NSGraphicsContext graphicsContextWithWindow: mpFrame->getNSWindow()];
-SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
-                CGContextRef xCGContext = static_cast<CGContextRef>([pNSGContext graphicsPort]);
-SAL_WNODEPRECATED_DECLARATIONS_POP
+                CGContextRef xCGContext = [pNSGContext CGContext];
                 mxLayer = CGLayerCreateWithContext(xCGContext, aLayerSize, nullptr);
                 SAL_INFO("vcl.cg", "CGLayerCreateWithContext(" << xCGContext << "," << aLayerSize << ",NULL) = " << mxLayer);
                 if (mxLayer)
@@ -208,10 +206,8 @@ void AquaSalGraphics::UpdateWindow( NSRect& )
     NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
     if( (mxLayer != nullptr) && (pContext != nullptr) )
     {
-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 );
+        CGContextRef rCGContext = [pContext CGContext];
+        SAL_INFO( "vcl.cg", "[[NSGraphicsContext currentContext] CGContext] = " << rCGContext );
 
         CGMutablePathRef rClip = mpFrame->getClipPath();
         if( rClip )
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index ee1f5e61f96f..96a64ae765b5 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -263,9 +263,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
                 NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pNSWindow];
                 if( pNSContext )
                 {
-SAL_WNODEPRECATED_DECLARATIONS_PUSH // 'graphicsPort' is deprecated: first deprecated in macOS 10.14
-                    xCGContext = static_cast<CGContextRef>([pNSContext graphicsPort]);
-SAL_WNODEPRECATED_DECLARATIONS_POP
+                    xCGContext = [pNSContext CGContext];
                 }
             }
         }


More information about the Libreoffice-commits mailing list