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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 27 13:59:55 UTC 2021


 vcl/inc/quartz/salgdi.h     |    2 +-
 vcl/quartz/salgdi.cxx       |    6 ++----
 vcl/quartz/salgdicommon.cxx |   12 ++++++------
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 1e70359ac7f2e10f7cefe006557b3df8e5a46ae0
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Apr 8 13:27:34 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Apr 27 15:59:11 2021 +0200

    vcl: store XorEmulation in a unique_ptr not raw pointer
    
    Change-Id: I123c4048d333cdc761582763d6ccb9c254e32bbb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114700
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 421cbffba55b..80e6c66d1a00 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -137,7 +137,7 @@ class AquaSalGraphics : public SalGraphics
     CGContextHolder maBGContextHolder;  // Quartz drawing context for CGLayer
     CGContextHolder maCSContextHolder;  // Quartz drawing context considering the color space
 
-    XorEmulation*                           mpXorEmulation;
+    std::unique_ptr<XorEmulation> mpXorEmulation;
     int                                     mnXorMode; // 0: off 1: on 2: invert only
     int                                     mnWidth;
     int                                     mnHeight;
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index ae6a40cfd4e2..375fea64a5cb 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -186,8 +186,7 @@ bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit
 }
 
 AquaSalGraphics::AquaSalGraphics()
-    : mpXorEmulation( nullptr )
-    , mnXorMode( 0 )
+    : mnXorMode( 0 )
     , mnWidth( 0 )
     , mnHeight( 0 )
     , mnBitmapDepth( 0 )
@@ -229,8 +228,7 @@ AquaSalGraphics::~AquaSalGraphics()
 
     ReleaseFonts();
 
-    if( mpXorEmulation )
-        delete mpXorEmulation;
+    mpXorEmulation.reset();
 
 #ifdef IOS
     if (mbForeignContext)
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 51e35e79905a..db6715ce01e2 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -242,11 +242,11 @@ static Color ImplGetROPColor( SalROPColor nROPColor )
 // apply the XOR mask to the target context if active and dirty
 void AquaSalGraphics::ApplyXorContext()
 {
-    if( !mpXorEmulation )
+    if (!mpXorEmulation)
     {
         return;
     }
-    if( mpXorEmulation->UpdateTarget() )
+    if (mpXorEmulation->UpdateTarget())
     {
         RefreshRect( 0, 0, mnWidth, mnHeight ); // TODO: refresh minimal changerect
     }
@@ -1486,11 +1486,11 @@ void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly )
         return;
     }
 
-    if( (mpXorEmulation == nullptr) && !bSet )
+    if (!mpXorEmulation && !bSet)
     {
         return;
     }
-    if( (mpXorEmulation != nullptr) && (bSet == mpXorEmulation->IsEnabled()) )
+    if (mpXorEmulation && bSet == mpXorEmulation->IsEnabled())
     {
         return;
     }
@@ -1499,9 +1499,9 @@ void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly )
          return;
     }
     // prepare XOR emulation
-    if( !mpXorEmulation )
+    if (!mpXorEmulation)
     {
-        mpXorEmulation = new XorEmulation();
+        mpXorEmulation = std::make_unique<XorEmulation>();
         mpXorEmulation->SetTarget(mnWidth, mnHeight, mnBitmapDepth, maContextHolder.get(), maLayer.get());
     }
 


More information about the Libreoffice-commits mailing list