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

Caolán McNamara caolanm at redhat.com
Thu Jan 21 12:50:46 PST 2016


 vcl/headless/svpbmp.cxx       |   11 +++++------
 vcl/unx/gtk3/gtk3gtkframe.cxx |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit d363a9e20db9b404ff81ca673268f2abef06e3f0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 20:47:12 2016 +0000

    new[] failed but memset of requested len called anyway
    
    recent regression from
    
    commit a73e606b8cd714520285b4e40890db9fd27d7ba5
    Date:   Thu Jan 21 16:04:28 2016 +0100
    
        Quickfix for deterministic SvpSalBitmap checksums
    
    move the memset (and similar memcpy) inside try block
    
    Change-Id: I51d76777f91664459deb777a5dfafae80203af57

diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 293b222..59d5964 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -121,17 +121,17 @@ BitmapBuffer* ImplCreateDIB(
                 pDIB->maPalette.SetEntryCount( nColors );
             }
 
-            auto size = pDIB->mnScanlineSize * pDIB->mnHeight;
             try
             {
+                size_t size = pDIB->mnScanlineSize * pDIB->mnHeight;
                 pDIB->mpBits = new sal_uInt8[size];
+                std::memset(pDIB->mpBits, 0, size);
             }
             catch (const std::bad_alloc&)
             {
                 delete pDIB;
                 pDIB = nullptr;
             }
-            std::memset(pDIB->mpBits, 0, size);
         }
     }
     else
@@ -167,16 +167,15 @@ bool SvpSalBitmap::Create(const SalBitmap& rBmp)
         // TODO: get rid of this when BitmapBuffer gets copy constructor
         try
         {
-            mpDIB->mpBits = new sal_uInt8[ mpDIB->mnScanlineSize * mpDIB->mnHeight ];
+            size_t size = mpDIB->mnScanlineSize * mpDIB->mnHeight;
+            mpDIB->mpBits = new sal_uInt8[size];
+            std::memcpy(mpDIB->mpBits, rSalBmp.mpDIB->mpBits, size);
         }
         catch (const std::bad_alloc&)
         {
             delete mpDIB;
             mpDIB = nullptr;
         }
-
-        if (mpDIB)
-            memcpy(mpDIB->mpBits, rSalBmp.mpDIB->mpBits, mpDIB->mnScanlineSize * mpDIB->mnHeight);
     }
 
     return !rSalBmp.mpDIB || (rSalBmp.mpDIB && mpDIB != nullptr);
commit 4f91e4f3f9e80b4b258f07d29cc2ea490d8e7417
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 21 17:46:15 2016 +0000

    gtk3: use gdk_window_create_similar_image_surface
    
    maybe there is some small benefit to doing so, at least open us up
    to that possibility
    
    Change-Id: Ib1fcdf4a613c729b559bdbe653ed80e68bcb1ff3

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 803542d..738e06e 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1534,9 +1534,19 @@ void GtkSalFrame::AllocateFrame()
 
         if (m_pSurface)
             cairo_surface_destroy(m_pSurface);
+
+
+#if GTK_CHECK_VERSION(3,10,0)
+        m_pSurface = gdk_window_create_similar_image_surface(widget_get_window(m_pWindow),
+                                                             CAIRO_FORMAT_ARGB32,
+                                                             aFrameSize.getX(),
+                                                             aFrameSize.getY(),
+                                                             0);
+#else
         m_pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
-                            aFrameSize.getX(),
-                            aFrameSize.getY());
+                                                aFrameSize.getX(),
+                                                aFrameSize.getY());
+#endif
         cairo_surface_set_user_data(m_pSurface, SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr);
         SAL_INFO("vcl.gtk3", "allocated Frame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight);
 


More information about the Libreoffice-commits mailing list