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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 27 11:25:30 UTC 2019


 vcl/inc/unx/gtk/gtkgdi.hxx           |    2 +-
 vcl/unx/gtk/salnativewidgets-gtk.cxx |   27 +++++++++++++--------------
 2 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit b7ec6ddcf69df9617a2294298204096fc8e1557e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Mar 27 08:58:47 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Mar 27 12:25:04 2019 +0100

    return by unique_ptr from NWGetPixmapFromScreen
    
    Change-Id: I26cde2c0a6b605f0d638bb252e0809ac6dece26a
    Reviewed-on: https://gerrit.libreoffice.org/69785
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index ee42a2baf433..707b0a2918c2 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -295,7 +295,7 @@ public:
 
 protected:
 
-    GdkX11Pixmap* NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor = 0 );
+    std::unique_ptr<GdkX11Pixmap> NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor = 0 );
     bool NWRenderPixmapToScreen( GdkX11Pixmap* pPixmap, GdkX11Pixmap* pMask, tools::Rectangle dstRect );
 
     bool DoDrawNativeControl( GdkDrawable* pDrawable,
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 767a53410df9..b0f015a24fe7 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -871,8 +871,8 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
     {
         if( bNeedTwoPasses )
         {
-            xPixmap.reset( NWGetPixmapFromScreen( aPixmapRect, BG_WHITE ) );
-            xMask.reset( NWGetPixmapFromScreen( aPixmapRect, BG_BLACK ) );
+            xPixmap = NWGetPixmapFromScreen( aPixmapRect, BG_WHITE );
+            xMask = NWGetPixmapFromScreen( aPixmapRect, BG_BLACK );
             if( !xPixmap || !xMask )
                 return false;
             nPasses = 2;
@@ -881,7 +881,7 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
         }
         else
         {
-            xPixmap.reset( NWGetPixmapFromScreen( aPixmapRect, BG_FILL ) );
+            xPixmap = NWGetPixmapFromScreen( aPixmapRect, BG_FILL );
             if( !xPixmap )
                 return false;
             nPasses = 1;
@@ -1298,13 +1298,13 @@ bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
     if( bNeedTwoPasses ) \
     { \
         _nPasses = 2; \
-        _pixmap.reset( NWGetPixmapFromScreen( aRect, BG_WHITE ) ); \
-        _mask.reset( NWGetPixmapFromScreen( aRect, BG_BLACK ) ); \
+        _pixmap = NWGetPixmapFromScreen( aRect, BG_WHITE ); \
+        _mask = NWGetPixmapFromScreen( aRect, BG_BLACK ); \
     } \
     else \
     { \
         _nPasses = 1; \
-        _pixmap.reset( NWGetPixmapFromScreen( aRect, BG_FILL ) ); \
+        _pixmap = NWGetPixmapFromScreen( aRect, BG_FILL ); \
     } \
     if( !_pixmap || ( bNeedTwoPasses && !_mask ) ) \
         return false; \
@@ -1329,13 +1329,13 @@ bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
     if( bNeedTwoPasses ) \
     { \
         _nPasses = 2; \
-        pixmap = NWGetPixmapFromScreen( aRect, BG_WHITE ); \
-        mask = NWGetPixmapFromScreen( aRect, BG_BLACK ); \
+        pixmap = NWGetPixmapFromScreen( aRect, BG_WHITE ).release(); \
+        mask = NWGetPixmapFromScreen( aRect, BG_BLACK ).release(); \
     } \
     else \
     { \
         _nPasses = 1; \
-        pixmap = NWGetPixmapFromScreen( aRect, BG_FILL ); \
+        pixmap = NWGetPixmapFromScreen( aRect, BG_FILL ).release(); \
         mask = nullptr; \
     } \
     if( !pixmap || ( bNeedTwoPasses && !mask ) ) \
@@ -2031,7 +2031,7 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlPart nPart,
 
     // as multiple paints are required for the scrollbar
     // painting them directly to the window flickers
-    pixmap.reset( NWGetPixmapFromScreen( pixmapRect ) );
+    pixmap = NWGetPixmapFromScreen( pixmapRect );
     if( ! pixmap )
         return false;
     x = y = 0;
@@ -4066,16 +4066,15 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
  * Create a GdkPixmap filled with the contents of an area of an Xlib window
  ************************************************************************/
 
-GdkX11Pixmap* GtkSalGraphics::NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor )
+std::unique_ptr<GdkX11Pixmap> GtkSalGraphics::NWGetPixmapFromScreen( tools::Rectangle srcRect, int nBgColor )
 {
-    GdkX11Pixmap* pPixmap;
     int nDepth = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetVisual( m_nXScreen ).GetDepth();
 
-    pPixmap = new GdkX11Pixmap( srcRect.GetWidth(), srcRect.GetHeight(), nDepth );
+    std::unique_ptr<GdkX11Pixmap> pPixmap(new GdkX11Pixmap( srcRect.GetWidth(), srcRect.GetHeight(), nDepth ));
 
     if( nBgColor == BG_FILL )
     {
-        FillPixmapFromScreen( pPixmap, srcRect.Left(), srcRect.Top() );
+        FillPixmapFromScreen( pPixmap.get(), srcRect.Left(), srcRect.Top() );
     }
     else if( nBgColor != BG_NONE )
     {


More information about the Libreoffice-commits mailing list