diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-24 13:39:42 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-05-21 23:52:56 +0200 |
commit | 95452fc8f29e1bcf5694788a08b7099bb56c7bba (patch) | |
tree | a793239b6ee78e7c00a6633c9f194f6b4c242d98 | |
parent | d0c6ea67b48bf1cde719175b4afba1f769b37726 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basebmp/source/bitmapdevice.cxx | 25 | ||||
-rw-r--r-- | basebmp/test/basictest.cxx | 39 | ||||
-rw-r--r-- | basebmp/test/bmpmasktest.cxx | 24 | ||||
-rw-r--r-- | basebmp/test/bmptest.cxx | 12 | ||||
-rw-r--r-- | basebmp/test/cliptest.cxx | 12 | ||||
-rw-r--r-- | basebmp/test/filltest.cxx | 6 | ||||
-rw-r--r-- | basebmp/test/linetest.cxx | 12 | ||||
-rw-r--r-- | basebmp/test/masktest.cxx | 9 | ||||
-rw-r--r-- | basebmp/test/polytest.cxx | 6 | ||||
-rw-r--r-- | include/basebmp/bitmapdevice.hxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 6 |
12 files changed, 57 insertions, 105 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 4ef38f05d939..2710fb849f02 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -1956,7 +1956,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, @@ -1977,6 +1976,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; @@ -2139,14 +2140,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; @@ -2172,24 +2172,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(), NULL, @@ -2199,13 +2195,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, NULL, @@ -2215,14 +2209,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, NULL, @@ -2235,7 +2227,6 @@ BitmapDeviceSharedPtr createClipDevice( const basegfx::B2IVector& rSize ) createBitmapDeviceImpl( rSize, false, /* bTopDown */ basebmp::FORMAT_ONE_BIT_MSB_GREY, - getBitmapDeviceStrideForWidth(basebmp::FORMAT_ONE_BIT_MSB_GREY, rSize.getX()), boost::shared_array< sal_uInt8 >(), PaletteMemorySharedVector(), NULL, @@ -2251,7 +2242,6 @@ BitmapDeviceSharedPtr subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto, return createBitmapDeviceImpl( rProto->getSize(), rProto->isTopDown(), rProto->getScanlineFormat(), - rProto->getScanlineStride(), rProto->getBuffer(), rProto->getPalette(), &rSubset, @@ -2264,7 +2254,6 @@ BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize, return createBitmapDeviceImpl( rSize, rProto->isTopDown(), rProto->getScanlineFormat(), - rProto->getScanlineStride(), boost::shared_array< sal_uInt8 >(), rProto->getPalette(), NULL, diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 293fbe5d1c17..14c0fe4a8cb5 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -83,16 +83,18 @@ public: basegfx::B2ISize aSize2(aSize); BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()))); - CPPUNIT_ASSERT_MESSAGE("right size", - pDevice->getSize() == aSize2 ); + FORMAT_ONE_BIT_MSB_PAL ) ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("right size", + aSize2, pDevice->getSize() ); CPPUNIT_ASSERT_MESSAGE("Top down format", pDevice->isTopDown() ); - CPPUNIT_ASSERT_MESSAGE("Scanline format", - pDevice->getScanlineFormat() == FORMAT_ONE_BIT_MSB_PAL ); - CPPUNIT_ASSERT_MESSAGE("Scanline len", - pDevice->getScanlineStride() == (aSize2.getY() + 7)/8 ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Scanline format", + FORMAT_ONE_BIT_MSB_PAL, 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", + nExpectedStride, pDevice->getScanlineStride() ); CPPUNIT_ASSERT_MESSAGE("Palette existence", pDevice->getPalette() ); CPPUNIT_ASSERT_MESSAGE("Palette entry 0 is black", @@ -107,8 +109,7 @@ public: basegfx::B2ISize aSize2(3,3); BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()))); + FORMAT_ONE_BIT_MSB_PAL ) ); BitmapDeviceSharedPtr pClone( cloneBitmapDevice( aSize2, @@ -123,8 +124,7 @@ public: const basegfx::B2ISize aSize(64,64); BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()))); + FORMAT_ONE_BIT_MSB_PAL ) ); const basegfx::B2IPoint aPt(3,3); CPPUNIT_ASSERT_MESSAGE("getPixelData for virgin device", @@ -171,8 +171,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_LSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_LSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_LSB_PAL ); pDevice->setPixel( aPt2, aCol, DrawMode_PAINT ); CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #4", @@ -197,8 +196,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - FORMAT_EIGHT_BIT_GREY, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_EIGHT_BIT_GREY, aSize.getX())); + FORMAT_EIGHT_BIT_GREY ); const Color aCol4(0x010101); pDevice->setPixel( aPt, aCol4, DrawMode_PAINT ); @@ -220,8 +218,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - FORMAT_SIXTEEN_BIT_LSB_TC_MASK, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_SIXTEEN_BIT_LSB_TC_MASK, aSize.getX())); + FORMAT_SIXTEEN_BIT_LSB_TC_MASK ); const Color aCol7(0); pDevice->clear( aCol7 ); @@ -245,8 +242,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - FORMAT_TWENTYFOUR_BIT_TC_MASK, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_TWENTYFOUR_BIT_TC_MASK, aSize.getX())); + FORMAT_TWENTYFOUR_BIT_TC_MASK ); const Color aCol4(0x01010101); pDevice->setPixel( aPt, aCol4, DrawMode_PAINT ); @@ -273,8 +269,7 @@ public: { pDevice = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX())); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); const Color aCol4(0x01010101); pDevice->setPixel( aPt, aCol4, DrawMode_PAINT ); diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx index 611e18955279..8580b80d72f7 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_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX())); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); mpMaskBmp1bpp = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_GREY, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_GREY, aSize.getX())); + FORMAT_ONE_BIT_MSB_GREY ); mpBmp1bpp = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_MSB_PAL ); mpBmp32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX())); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); 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::DrawMode_PAINT ); xBitmap = createBitmapDevice( aSize, false, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX, - basebmp::getBitmapDeviceStrideForWidth( - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX, aSize.getX() ) ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX ); xBitmap->clear(Color(0x80808080)); } { // mpOutput & mpBitmap const basegfx::B2ISize aSize(9, 9); xOutput = createBitmapDevice( aSize, false, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX, - basebmp::getBitmapDeviceStrideForWidth( - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX, aSize.getX()) ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX ); xOutput->clear(Color(0xffffffff)); } diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 30644fb74930..1f051aed1034 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -148,23 +148,19 @@ public: void setUp() SAL_OVERRIDE { const basegfx::B2ISize aSize(10,10); - sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()); mpDevice1bpp = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, nStride ); - nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX()); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, nStride ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); - nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()); mpBmp1bpp = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, nStride ); - nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX()); + FORMAT_ONE_BIT_MSB_PAL ); mpBmp32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, nStride ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); OUString aSvg( "m 0 0h5v10h5v-5h-10z" ); diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index 13ad48c37a43..8526964a08ac 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_EIGHT_BIT_GREY, rDevice->getSize().getX()); BitmapDeviceSharedPtr pBmp( createBitmapDevice( rDevice->getSize(), true, - FORMAT_EIGHT_BIT_GREY, nStride )); + FORMAT_EIGHT_BIT_GREY )); OUString aSvg( "m 0 0h5v10h5v-5h-10z" ); @@ -189,18 +188,15 @@ public: void setUp() SAL_OVERRIDE { const basegfx::B2ISize aSize(11,11); - sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_GREY, aSize.getX()); mpClipMask = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_GREY, nStride ); - nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()); + FORMAT_ONE_BIT_MSB_GREY ); mpDevice1bpp = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, nStride ); - nStride = basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX()); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, nStride ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); 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 875a27dac2e5..067ec24cb471 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_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX())); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); } void testRectFill() diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index 731158e693f6..f6a39099087c 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_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()) ); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX()) ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); } void testCornerCases() @@ -165,8 +163,7 @@ public: BitmapDeviceSharedPtr pDevice = createBitmapDevice( aSize, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()) ); + FORMAT_ONE_BIT_MSB_PAL ); const basegfx::B2IPoint aPt1(0,0); const basegfx::B2IPoint aPt2(10,10); @@ -182,8 +179,7 @@ public: pDevice = createBitmapDevice( aSize2, true, - FORMAT_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_MSB_PAL ); CPPUNIT_ASSERT_MESSAGE("only pixel cleared", pDevice->getPixelData(aPt1) == 0); diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 7b4559cd6784..d53ba72ab11d 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_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX()) ); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX()) ); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); mpMask = createBitmapDevice( aSize, true, - FORMAT_EIGHT_BIT_GREY, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_EIGHT_BIT_GREY, aSize.getX()) ); + FORMAT_EIGHT_BIT_GREY ); OUString aSvg( "m 0 0h5v10h5v-5h-10z" ); diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx index 60746d753756..a0371ebe21cc 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_ONE_BIT_MSB_PAL, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_ONE_BIT_MSB_PAL, aSize.getX())); + FORMAT_ONE_BIT_MSB_PAL ); mpDevice32bpp = createBitmapDevice( aSize, true, - FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, - basebmp::getBitmapDeviceStrideForWidth(FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA, aSize.getX())); + FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA ); } void testEmpty() diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx index 595374183697..6071c79fc223 100644 --- a/include/basebmp/bitmapdevice.hxx +++ b/include/basebmp/bitmapdevice.hxx @@ -668,8 +668,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 @@ -681,7 +680,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 @@ -693,7 +691,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 ); @@ -725,8 +722,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 c6f372aef22f..3ec5d0c92a10 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -774,7 +774,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/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index b69eabc938b7..c594945ef0d9 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -2063,9 +2063,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, - basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX, 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); |