[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Oct 6 02:16:18 PDT 2015


 vcl/source/gdi/virdev.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 08ef823974901a42bf6c39aabcc55397784e0699
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Sep 28 12:51:02 2015 +0200

    don't allocate (by eraseing) an un-initialized 1x1 virtual device
    
    Change-Id: I11c7063d7ac689866461ceabf8648f1c3c7bb17d
    (cherry picked from commit d76c5aa78f0b9004c6719dcc4d2be052c0703ba5)
    Reviewed-on: https://gerrit.libreoffice.org/19162
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 04ac2d7..b24378d 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -129,6 +129,8 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
 {
     SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << nBitCount << ")" );
 
+    bool bErase = nDX > 0 && nDY > 0;
+
     if ( nDX < 1 )
         nDX = 1;
 
@@ -191,7 +193,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
     SetBackground( Wallpaper( Color( COL_WHITE ) ) );
 
     // #i59283# don't erase user-provided surface
-    if( !pData )
+    if( !pData && bErase)
         Erase();
 
     // register VirDev in the list
@@ -212,7 +214,7 @@ VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
 
-    ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
+    ImplInitVirDev( Application::GetDefaultDevice(), 0, 0, nBitCount );
 }
 
 VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount )
@@ -223,7 +225,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
 
-    ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
+    ImplInitVirDev( &rCompDev, 0, 0, nBitCount );
 }
 
 VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount )
@@ -235,7 +237,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
     SAL_INFO( "vcl.gdi",
             "VirtualDevice::VirtualDevice( " << nBitCount << ", " << nAlphaBitCount << " )" );
 
-    ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
+    ImplInitVirDev( &rCompDev, 0, 0, nBitCount );
 
     // Enable alpha channel
     mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);


More information about the Libreoffice-commits mailing list