basebmp/source/bitmapdevice.cxx          |   25 +++++++------------------
 basebmp/test/basictest.cxx               |   29 ++++++++++++-----------------
 basebmp/test/bmpmasktest.cxx             |   24 +++++++-----------------
 basebmp/test/bmptest.cxx                 |   12 ++++--------
 basebmp/test/cliptest.cxx                |   12 ++++--------
 basebmp/test/filltest.cxx                |    6 ++----
 basebmp/test/linetest.cxx                |   12 ++++--------
 basebmp/test/masktest.cxx                |    9 +++------
 basebmp/test/polytest.cxx                |    6 ++----
 include/basebmp/bitmapdevice.hxx         |    9 +++------
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |    2 +-
 vcl/headless/svpbmp.cxx                  |    6 ++----
 vcl/headless/svpframe.cxx                |    3 +--
 vcl/headless/svpgdi.cxx                  |    5 +++--
 vcl/headless/svpvd.cxx                   |    7 +++----
 vcl/qa/cppunit/BitmapTest.cxx            |   15 +++++----------
 vcl/unx/gtk/gtksalframe.cxx              |    6 +++---
 17 files changed, 66 insertions(+), 122 deletions(-)

New commits:
commit 9b52b8999be86e5c6e5f5901b2640b16f08a2323
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Nov 24 13:39:42 2015 +0000

    Resolves: tdf#95962 incorrect scanline stride
    
    we were reusing the stride of the surface we were cloning,
    but the new surface has a different underlying size.
    
    remove the custom stride argument and just change our stride
    calculation to use the same scheme that cairo and GDI uses, which
    remove another platform/drawing-system variable
    
    Change-Id: I257dac9757b121642e9ccfde7db0911edc9f3fb1
    Reviewed-on: https://gerrit.libreoffice.org/20149
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 4260edb..01bfe25 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -1929,7 +1929,6 @@ namespace
 BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&   
               rSize,
                                                    bool                        
               bTopDown,
                                                    Format                      
               nScanlineFormat,
-                                                   sal_Int32                   
               nScanlineStride,
                                                    boost::shared_array< 
sal_uInt8 >           pMem,
                                                    PaletteMemorySharedVector   
               pPal,
                                                    const basegfx::B2IBox*      
               pSubset,
@@ -1950,6 +1949,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const 
basegfx::B2IVector&
         return BitmapDeviceSharedPtr();
     }
 
+    sal_Int32 nScanlineStride = getBitmapDeviceStrideForWidth(nScanlineFormat, 
rSize.getX());
+
     // factor in bottom-up scanline order case
     nScanlineStride *= bTopDown ? 1 : -1;
 
@@ -2112,14 +2113,13 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( 
const basegfx::B2IVector&
 BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector&        
          rSize,
                                               bool                             
          bTopDown,
                                               Format                           
          nScanlineFormat,
-                                              sal_Int32                        
          nScanlineStride,
                                               boost::shared_array< sal_uInt8 > 
          pMem,
                                               PaletteMemorySharedVector        
          pPal,
                                               const basegfx::B2IBox*           
          pSubset,
                                               const 
IBitmapDeviceDamageTrackerSharedPtr& rDamage,
                                               bool bBlack = true)
 {
-    BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, 
bTopDown, nScanlineFormat, nScanlineStride, pMem, pPal, pSubset, rDamage, 
bBlack ) );
+    BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, 
bTopDown, nScanlineFormat, pMem, pPal, pSubset, rDamage, bBlack ) );
 
 #ifdef SAL_LOG_INFO
     std::ostringstream subset;
@@ -2145,24 +2145,20 @@ sal_Int32 getBitmapDeviceStrideForWidth(Format 
nScanlineFormat, sal_Int32 nWidth
     // round up to full 8 bit, divide by 8
     sal_Int32 nScanlineStride = (nWidth*nBitsPerPixel + 7) >> 3;
 
-    // rounded up to next full power-of-two number of bytes
-    const sal_uInt32 bytesPerPixel = nextPow2(
-        (bitsPerPixel[nScanlineFormat] + 7) >> 3);
+    // pixman (cairo) and GDI (windows) pad to multiples of 32bits
+    // so do the same to be easily compatible
+    nScanlineStride = (nScanlineStride + 3) & ~0x3;
 
-    // now make nScanlineStride a multiple of bytesPerPixel
-    nScanlineStride = (nScanlineStride + bytesPerPixel - 1) / bytesPerPixel * 
bytesPerPixel;
     return nScanlineStride;
 }
 
 BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
                                           bool                      bTopDown,
-                                          Format                    
nScanlineFormat,
-                                          sal_Int32                 
nScanlineStride )
+                                          Format                    
nScanlineFormat )
 {
     return createBitmapDeviceImpl( rSize,
                                    bTopDown,
                                    nScanlineFormat,
-                                   nScanlineStride,
                                    boost::shared_array< sal_uInt8 >(),
                                    PaletteMemorySharedVector(),
                                    nullptr,
@@ -2172,13 +2168,11 @@ BitmapDeviceSharedPtr createBitmapDevice( const 
basegfx::B2IVector& rSize,
 BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector&        
rSize,
                                           bool                             
bTopDown,
                                           Format                           
nScanlineFormat,
-                                          sal_Int32                        
nScanlineStride,
                                           const PaletteMemorySharedVector& 
rPalette )
 {
     return createBitmapDeviceImpl( rSize,
                                    bTopDown,
                                    nScanlineFormat,
-                                   nScanlineStride,
                                    boost::shared_array< sal_uInt8 >(),
                                    rPalette,
                                    nullptr,
@@ -2188,14 +2182,12 @@ BitmapDeviceSharedPtr createBitmapDevice( const 
basegfx::B2IVector&        rSize
 BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector&        
rSize,
                                           bool                             
bTopDown,
                                           Format                           
nScanlineFormat,
-                                          sal_Int32                        
nScanlineStride,
                                           const RawMemorySharedArray&      
rMem,
                                           const PaletteMemorySharedVector& 
rPalette )
 {
     return createBitmapDeviceImpl( rSize,
                                    bTopDown,
                                    nScanlineFormat,
-                                   nScanlineStride,
                                    rMem,
                                    rPalette,
                                    nullptr,
@@ -2208,7 +2200,6 @@ BitmapDeviceSharedPtr createClipDevice( const 
basegfx::B2IVector&        rSize )
              createBitmapDeviceImpl( rSize,
                                      false, /* bTopDown */
                                      basebmp::Format::OneBitMsbGrey,
-                                     
getBitmapDeviceStrideForWidth(basebmp::Format::OneBitMsbGrey, rSize.getX()),
                                      boost::shared_array< sal_uInt8 >(),
                                      PaletteMemorySharedVector(),
                                      nullptr,
@@ -2224,7 +2215,6 @@ BitmapDeviceSharedPtr subsetBitmapDevice( const 
BitmapDeviceSharedPtr& rProto,
     return createBitmapDeviceImpl( rProto->getSize(),
                                    rProto->isTopDown(),
                                    rProto->getScanlineFormat(),
-                                   rProto->getScanlineStride(),
                                    rProto->getBuffer(),
                                    rProto->getPalette(),
                                    &rSubset,
@@ -2237,7 +2227,6 @@ BitmapDeviceSharedPtr cloneBitmapDevice( const 
basegfx::B2IVector&    rSize,
     return createBitmapDeviceImpl( rSize,
                                    rProto->isTopDown(),
                                    rProto->getScanlineFormat(),
-                                   rProto->getScanlineStride(),
                                    boost::shared_array< sal_uInt8 >(),
                                    rProto->getPalette(),
                                    nullptr,
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx
index ebc1fcb..2751bbf 100644
--- a/basebmp/test/basictest.cxx
+++ b/basebmp/test/basictest.cxx
@@ -111,16 +111,18 @@ public:
         basegfx::B2ISize       aSize2(aSize);
         BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
                                                            true,
-                                                           
Format::OneBitMsbPal,
-                                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX())));
+                                                           
Format::OneBitMsbPal ) );
         CPPUNIT_ASSERT_EQUAL_MESSAGE("right size",
                                aSize2, pDevice->getSize() );
         CPPUNIT_ASSERT_MESSAGE("Top down format",
                                pDevice->isTopDown() );
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Scanline format",
                                Format::OneBitMsbPal, 
pDevice->getScanlineFormat() );
+        sal_Int32 nExpectedStride = (aSize2.getY() + 7)/8;
+        sal_Int32 nAlign = sizeof(sal_uInt32);
+        nExpectedStride = ((nExpectedStride + nAlign-1) / nAlign) * nAlign;
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Scanline len",
-                               (aSize2.getY() + 7)/8, 
pDevice->getScanlineStride() );
+                               nExpectedStride, pDevice->getScanlineStride() );
         CPPUNIT_ASSERT_MESSAGE("Palette existence",
                                pDevice->getPalette() );
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Palette entry 0 is black",
@@ -135,8 +137,7 @@ public:
         basegfx::B2ISize       aSize2(3,3);
         BitmapDeviceSharedPtr  pDevice( createBitmapDevice( aSize,
                                                             true,
-                                                            
Format::OneBitMsbPal,
-                                                            
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX())));
+                                                            
Format::OneBitMsbPal ) );
 
         BitmapDeviceSharedPtr  pClone( cloneBitmapDevice(
                                            aSize2,
@@ -151,8 +152,7 @@ public:
         const basegfx::B2ISize aSize(64,64);
         BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
                                                            true,
-                                                           
Format::OneBitMsbPal,
-                                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX())));
+                                                           
Format::OneBitMsbPal ) );
 
         const basegfx::B2IPoint aPt(3,3);
         CPPUNIT_ASSERT_EQUAL_MESSAGE("getPixelData for virgin device",
@@ -199,8 +199,7 @@ public:
         {
             pDevice = createBitmapDevice( aSize,
                                           true,
-                                          Format::OneBitLsbPal,
-                                          
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitLsbPal, aSize.getX()));
+                                          Format::OneBitLsbPal );
 
             pDevice->setPixel( aPt2, aCol, DrawMode::Paint );
             CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #4",
@@ -225,8 +224,7 @@ public:
         {
             pDevice = createBitmapDevice( aSize,
                                           true,
-                                          Format::EightBitGrey,
-                                          
basebmp::getBitmapDeviceStrideForWidth(Format::EightBitGrey, aSize.getX()));
+                                          Format::EightBitGrey );
 
             const Color aCol4(0x010101);
             pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
@@ -248,8 +246,7 @@ public:
         {
             pDevice = createBitmapDevice( aSize,
                                           true,
-                                          Format::SixteenBitLsbTcMask,
-                                          
basebmp::getBitmapDeviceStrideForWidth(Format::SixteenBitLsbTcMask, 
aSize.getX()));
+                                          Format::SixteenBitLsbTcMask );
             const Color aCol7(0);
             pDevice->clear( aCol7 );
 
@@ -273,8 +270,7 @@ public:
         {
             pDevice = createBitmapDevice( aSize,
                                           true,
-                                          Format::TwentyFourBitTcMask,
-                                          
basebmp::getBitmapDeviceStrideForWidth(Format::TwentyFourBitTcMask, 
aSize.getX()));
+                                          Format::TwentyFourBitTcMask );
 
             const Color aCol4(0x01010101);
             pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
@@ -303,8 +299,7 @@ public:
         {
             pDevice = createBitmapDevice( aSize,
                                           true,
-                                          Format::ThirtyTwoBitTcMaskBGRA,
-                                          
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()));
+                                          Format::ThirtyTwoBitTcMaskBGRA );
 
             const Color aCol4(0x01010101);
             pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx
index 7e4440e..7f7e913 100644
--- a/basebmp/test/bmpmasktest.cxx
+++ b/basebmp/test/bmpmasktest.cxx
@@ -91,26 +91,21 @@ public:
         const basegfx::B2ISize aSize(10,10);
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()));
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                             true,
-                                            Format::ThirtyTwoBitTcMaskBGRA,
-                                            
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()));
+                                            Format::ThirtyTwoBitTcMaskBGRA );
 
         mpMaskBmp1bpp = createBitmapDevice( aSize,
                                             true,
-                                            Format::OneBitMsbGrey,
-                                            
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbGrey, aSize.getX()));
+                                            Format::OneBitMsbGrey );
 
         mpBmp1bpp = createBitmapDevice( aSize,
                                         true,
-                                        Format::OneBitMsbPal,
-                                        
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()));
+                                        Format::OneBitMsbPal );
         mpBmp32bpp = createBitmapDevice( aSize,
                                          true,
-                                         Format::ThirtyTwoBitTcMaskBGRA,
-                                         
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()));
+                                         Format::ThirtyTwoBitTcMaskBGRA );
 
         OUString aSvg( "m 0 0h5v10h5v-5h-10z" );
 
@@ -169,7 +164,6 @@ public:
 //            nFormat = Format::OneBitMsbGrey; // FIXME - un-comment me to 
crash hard.
             xMask = createBitmapDevice( aSize, false /* bTopDown */,
                                         nFormat,
-                                         
basebmp::getBitmapDeviceStrideForWidth( nFormat, aSize.getX()),
                                          PaletteMemorySharedVector(
                                                 new std::vector< 
basebmp::Color >(aDevPal) ) );
             // wipe to copy everything.
@@ -183,17 +177,13 @@ public:
                                     DrawMode::Paint );
 
             xBitmap = createBitmapDevice( aSize, false,
-                                          Format::ThirtyTwoBitTcMaskBGRX,
-                                          
basebmp::getBitmapDeviceStrideForWidth(
-                                                
Format::ThirtyTwoBitTcMaskBGRX, aSize.getX()) );
+                                          Format::ThirtyTwoBitTcMaskBGRX );
             xBitmap->clear(Color(0x80808080));
         }
         { // mpOutput & mpBitmap
             const basegfx::B2ISize aSize(9, 9);
             xOutput = createBitmapDevice( aSize, false,
-                                          Format::ThirtyTwoBitTcMaskBGRX,
-                                          
basebmp::getBitmapDeviceStrideForWidth(
-                                                
Format::ThirtyTwoBitTcMaskBGRX, aSize.getX()) );
+                                          Format::ThirtyTwoBitTcMaskBGRX );
             xOutput->clear(Color(0xffffffff));
         }
 
diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx
index 7a45a49..78783d4 100644
--- a/basebmp/test/bmptest.cxx
+++ b/basebmp/test/bmptest.cxx
@@ -148,23 +148,19 @@ public:
     void setUp() override
     {
         const basegfx::B2ISize aSize(10,10);
-        sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX());
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal, nStride );
-        nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX());
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                             true,
-                                            Format::ThirtyTwoBitTcMaskBGRA, 
nStride );
+                                            Format::ThirtyTwoBitTcMaskBGRA );
 
-        nStride = basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, 
aSize.getX());
         mpBmp1bpp = createBitmapDevice( aSize,
                                         true,
-                                        Format::OneBitMsbPal, nStride );
-        nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX());
+                                        Format::OneBitMsbPal );
         mpBmp32bpp = createBitmapDevice( aSize,
                                          true,
-                                         Format::ThirtyTwoBitTcMaskBGRA, 
nStride );
+                                         Format::ThirtyTwoBitTcMaskBGRA );
 
         OUString aSvg( "m 0 0h5v10h5v-5h-10z" );
 
diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx
index c159914..fba0957 100644
--- a/basebmp/test/cliptest.cxx
+++ b/basebmp/test/cliptest.cxx
@@ -154,10 +154,9 @@ private:
 
     void implTestMaskColorClip(const BitmapDeviceSharedPtr& rDevice)
     {
-        sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::EightBitGrey, 
rDevice->getSize().getX());
         BitmapDeviceSharedPtr pBmp( createBitmapDevice( rDevice->getSize(),
                                                         true,
-                                                        Format::EightBitGrey, 
nStride ));
+                                                        Format::EightBitGrey 
));
 
         OUString aSvg( "m 0 0h5v10h5v-5h-10z" );
 
@@ -189,18 +188,15 @@ public:
     void setUp() override
     {
         const basegfx::B2ISize aSize(11,11);
-        sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbGrey, aSize.getX());
         mpClipMask = createBitmapDevice( aSize,
                                          true,
-                                         Format::OneBitMsbGrey, nStride );
-        nStride = basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, 
aSize.getX());
+                                         Format::OneBitMsbGrey );
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal, nStride );
-        nStride = 
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX());
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::ThirtyTwoBitTcMaskBGRA, 
nStride );
+                                           Format::ThirtyTwoBitTcMaskBGRA );
 
         OUString aSvg( "m 0 0 h5 l5 5 v5 h-5 l-5-5 z" );
         basegfx::B2DPolyPolygon aPoly;
diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx
index 8f2ec81..cee7de5 100644
--- a/basebmp/test/filltest.cxx
+++ b/basebmp/test/filltest.cxx
@@ -211,12 +211,10 @@ public:
         const basegfx::B2ISize aSize(11,11);
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()));
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::ThirtyTwoBitTcMaskBGRA,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()));
+                                           Format::ThirtyTwoBitTcMaskBGRA );
     }
 
     void testRectFill()
diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx
index c839568..aa49d91 100644
--- a/basebmp/test/linetest.cxx
+++ b/basebmp/test/linetest.cxx
@@ -151,12 +151,10 @@ public:
         const basegfx::B2ISize aSize(11,11);
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()) );
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::ThirtyTwoBitTcMaskBGRA,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()) );
+                                           Format::ThirtyTwoBitTcMaskBGRA );
     }
 
     void testCornerCases()
@@ -165,8 +163,7 @@ public:
         BitmapDeviceSharedPtr pDevice = createBitmapDevice(
             aSize,
             true,
-            Format::OneBitMsbPal,
-            basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, 
aSize.getX()) );
+            Format::OneBitMsbPal );
 
         const basegfx::B2IPoint aPt1(0,0);
         const basegfx::B2IPoint aPt2(10,10);
@@ -182,8 +179,7 @@ public:
         pDevice = createBitmapDevice(
             aSize2,
             true,
-            Format::OneBitMsbPal,
-            basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, 
aSize.getX()));
+            Format::OneBitMsbPal );
 
         CPPUNIT_ASSERT_MESSAGE("only pixel cleared",
                                 pDevice->getPixelData(aPt1) == 0);
diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx
index b1556f0..433a08f 100644
--- a/basebmp/test/masktest.cxx
+++ b/basebmp/test/masktest.cxx
@@ -104,17 +104,14 @@ public:
         const basegfx::B2ISize aSize(10,10);
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()) );
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                             true,
-                                            Format::ThirtyTwoBitTcMaskBGRA,
-                                            
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()) );
+                                            Format::ThirtyTwoBitTcMaskBGRA );
 
         mpMask = createBitmapDevice( aSize,
                                      true,
-                                     Format::EightBitGrey,
-                                     
basebmp::getBitmapDeviceStrideForWidth(Format::EightBitGrey, aSize.getX()) );
+                                     Format::EightBitGrey );
 
         OUString aSvg( "m 0 0h5v10h5v-5h-10z" );
 
diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx
index d027e8e..e026861 100644
--- a/basebmp/test/polytest.cxx
+++ b/basebmp/test/polytest.cxx
@@ -296,12 +296,10 @@ public:
         const basegfx::B2ISize aSize(10,10);
         mpDevice1bpp = createBitmapDevice( aSize,
                                            true,
-                                           Format::OneBitMsbPal,
-                                           
basebmp::getBitmapDeviceStrideForWidth(Format::OneBitMsbPal, aSize.getX()));
+                                           Format::OneBitMsbPal );
         mpDevice32bpp = createBitmapDevice( aSize,
                                             true,
-                                            Format::ThirtyTwoBitTcMaskBGRA,
-                                            
basebmp::getBitmapDeviceStrideForWidth(Format::ThirtyTwoBitTcMaskBGRA, 
aSize.getX()));
+                                            Format::ThirtyTwoBitTcMaskBGRA );
     }
 
     void testEmpty()
diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx
index f3c4f5b..60e645a 100644
--- a/include/basebmp/bitmapdevice.hxx
+++ b/include/basebmp/bitmapdevice.hxx
@@ -665,8 +665,7 @@ sal_Int32 BASEBMP_DLLPUBLIC 
getBitmapDeviceStrideForWidth(Format nScanlineFormat
  */
 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const 
basegfx::B2IVector& rSize,
                                                             bool               
       bTopDown,
-                                                            Format             
       nScanlineFormat,
-                                                            sal_Int32          
       nScanlineStride );
+                                                            Format             
       nScanlineFormat );
 
 /** Function to create a BitmapDevice for given scanline format
     with the given palette
@@ -678,7 +677,6 @@ BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( 
const basegfx::B2IVe
 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const 
basegfx::B2IVector&        rSize,
                                                             bool               
              bTopDown,
                                                             Format             
              nScanlineFormat,
-                                                            sal_Int32          
              nScanlineStride,
                                                             const 
PaletteMemorySharedVector& rPalette );
 
 /** Function to create a BitmapDevice for given scanline format
@@ -690,7 +688,6 @@ BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( 
const basegfx::B2IVe
 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const 
basegfx::B2IVector&        rSize,
                                                             bool               
              bTopDown,
                                                             Format             
              nScanlineFormat,
-                                                            sal_Int32          
              nScanlineStride,
                                                             const 
RawMemorySharedArray&      rMem,
                                                             const 
PaletteMemorySharedVector& rPalette );
 
@@ -722,8 +719,8 @@ BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC subsetBitmapDevice( 
const BitmapDeviceSh
     copied, only the size can be varied. Note that the prototype's
     bitmap content is <em>not</em> copied, only a palette (if any).
  */
-BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice( const 
basegfx::B2IVector&    rSize,
-                                                           const 
BitmapDeviceSharedPtr& rProto );
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice(const 
basegfx::B2IVector& rSize,
+                                                          const 
BitmapDeviceSharedPtr& rProto);
 
 }
 
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 53b55b9..ef59606 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -773,7 +773,7 @@ DECLARE_OOXMLIMPORT_TEST(testN777345, "n777345.docx")
     Graphic aGraphic(xGraphic);
     // If this changes later, feel free to update it, but make sure it's not
     // the checksum of a white/transparent placeholder rectangle.
-    
CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(16427281842367305761)), 
aGraphic.GetChecksum());
+    
CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(12149824012634930130)), 
aGraphic.GetChecksum());
 #endif
 }
 
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 685463c..02f1453 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -50,9 +50,8 @@ bool SvpSalBitmap::Create( const Size& rSize,
         aSize.setX( 1 );
     if( aSize.getY() == 0 )
         aSize.setY( 1 );
-    sal_Int32 nStride = getBitmapDeviceStrideForWidth(nFormat, aSize.getX());
     if( nBitCount > 8 )
-        m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride );
+        m_aBitmap = createBitmapDevice( aSize, true, nFormat );
     else
     {
         // prepare palette
@@ -65,7 +64,7 @@ bool SvpSalBitmap::Create( const Size& rSize,
             const BitmapColor& rCol = rPalette[i];
             (*pPalette)[i] = basebmp::Color( rCol.GetRed(), rCol.GetGreen(), 
rCol.GetBlue() );
         }
-        m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride,
+        m_aBitmap = createBitmapDevice( aSize, true, nFormat,
                                         basebmp::RawMemorySharedArray(),
                                         basebmp::PaletteMemorySharedVector( 
pPalette )
                                         );
@@ -407,7 +406,6 @@ void SvpSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, 
BitmapAccessMode nMode
             m_aBitmap = basebmp::createBitmapDevice( m_aBitmap->getSize(),
                                                      m_aBitmap->isTopDown(),
                                                      
m_aBitmap->getScanlineFormat(),
-                                                     
m_aBitmap->getScanlineStride(),
                                                      m_aBitmap->getBuffer(),
                                                      pPal );
         }
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 39f1250..4a48abb 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -291,8 +291,7 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long 
nWidth, long nHeight, sal_u
             aFrameSize.setX( 1 );
         if( aFrameSize.getY() == 0 )
             aFrameSize.setY( 1 );
-        sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(m_nScanlineFormat, aFrameSize.getX());
-        m_aFrame = createBitmapDevice( aFrameSize, true, m_nScanlineFormat, 
nStride );
+        m_aFrame = createBitmapDevice( aFrameSize, true, m_nScanlineFormat );
         if (m_bDamageTracking)
             m_aFrame->setDamageTracker(
                 basebmp::IBitmapDeviceDamageTrackerSharedPtr( new 
DamageTracker ) );
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 7075bf5..f5d45d7 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -877,11 +877,12 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, 
long nWidth, long nHeigh
 {
     SvpSalBitmap* pBitmap = new SvpSalBitmap();
 
-    if (m_aDevice)
+    if (m_aOrigDevice)
     {
         basebmp::BitmapDeviceSharedPtr aCopy;
         aCopy = cloneBitmapDevice(basegfx::B2IVector(nWidth, nHeight),
-                                   m_aDevice);
+                                   m_aOrigDevice);
+        basegfx::B2IVector size = aCopy->getSize();
         basegfx::B2IBox aSrcRect( nX, nY, nX+nWidth, nY+nHeight );
         basegfx::B2IBox aDestRect( 0, 0, nWidth, nHeight );
 
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index 026da6b..6eb0a11 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -66,21 +66,20 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, 
long nNewDY,
     if( ! m_aDevice.get() || m_aDevice->getSize() != aDevSize )
     {
         basebmp::Format nFormat = 
SvpSalInstance::getBaseBmpFormatForDeviceFormat(m_eFormat);
-        sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(nFormat, 
aDevSize.getX());
 
         if (m_eFormat == DeviceFormat::BITMASK)
         {
             std::vector< basebmp::Color > aDevPal(2);
             aDevPal[0] = basebmp::Color( 0, 0, 0 );
             aDevPal[1] = basebmp::Color( 0xff, 0xff, 0xff );
-            m_aDevice = createBitmapDevice( aDevSize, true, nFormat, nStride,
+            m_aDevice = createBitmapDevice( aDevSize, true, nFormat,
                                             PaletteMemorySharedVector( new 
std::vector< basebmp::Color >(aDevPal) ) );
         }
         else
         {
             m_aDevice = pBuffer ?
-                          createBitmapDevice( aDevSize, true, nFormat, 
nStride, pBuffer, PaletteMemorySharedVector() )
-                        : createBitmapDevice( aDevSize, true, nFormat, nStride 
);
+                          createBitmapDevice( aDevSize, true, nFormat, 
pBuffer, PaletteMemorySharedVector() )
+                        : createBitmapDevice( aDevSize, true, nFormat );
         }
 
         // update device in existing graphics
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index c20c12b..33820e4 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -51,17 +51,12 @@ void BitmapTest::testConvert()
     {
         Bitmap::ScopedReadAccess pReadAccess(aBitmap);
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), 
pReadAccess->GetBitCount());
-#if defined WNT
-        if (!OpenGLHelper::isVCLOpenGLEnabled())
-        {
-            // GDI Scanlines padded to DWORD multiples, it seems
-            CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(12), 
pReadAccess->GetScanlineSize());
-        }
-        else
+#if defined MACOSX || defined IOS
+        //it would be nice to find and change the stride for quartz to be the 
same as everyone else
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(10), 
pReadAccess->GetScanlineSize());
+#else
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(12), 
pReadAccess->GetScanlineSize());
 #endif
-        {
-            CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(10), 
pReadAccess->GetScanlineSize());
-        }
         CPPUNIT_ASSERT(pReadAccess->HasPalette());
         const BitmapColor& rColor = 
pReadAccess->GetPaletteColor(pReadAccess->GetPixelIndex(1, 1));
         CPPUNIT_ASSERT_EQUAL(sal_Int32(204), sal_Int32(rColor.GetRed()));
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 39c3453..923581d 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -1967,9 +1967,9 @@ void GtkSalFrame::AllocateFrame()
             aFrameSize.setX( 1 );
         if( aFrameSize.getY() == 0 )
             aFrameSize.setY( 1 );
-        int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, 
aFrameSize.getX());
-        m_aFrame = basebmp::createBitmapDevice(aFrameSize, true,
-                                               SVP_CAIRO_FORMAT, cairo_stride);
+        m_aFrame = basebmp::createBitmapDevice(aFrameSize, true, 
SVP_CAIRO_FORMAT);
+        assert(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, 
aFrameSize.getX()) ==
+               m_aFrame->getScanlineStride());
         m_aFrame->setDamageTracker(
             basebmp::IBitmapDeviceDamageTrackerSharedPtr(new 
DamageTracker(*this)) );
         SAL_INFO("vcl.gtk3", "allocated m_aFrame size of " << 
maGeometry.nWidth << " x " << maGeometry.nHeight);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to