diff options
-rw-r--r-- | basebmp/source/bitmapdevice.cxx | 25 | ||||
-rw-r--r-- | basebmp/test/basictest.cxx | 29 | ||||
-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/headless/svpbmp.cxx | 6 | ||||
-rw-r--r-- | vcl/headless/svpframe.cxx | 3 | ||||
-rw-r--r-- | vcl/headless/svpgdi.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svpvd.cxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapTest.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalframe.cxx | 6 |
17 files changed, 66 insertions, 122 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 4260edb95bdd..01bfe25fb146 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 ebc1fcb479b4..2751bbfd9de9 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 7e4440e22eb6..7f7e9130c3d2 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 7a45a49f5ab7..78783d4fe4e3 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 c1599147dc0a..fba09576a513 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 8f2ec81c1f15..cee7de505f9b 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 c83956815312..aa49d91a08b4 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 b1556f0e12a5..433a08fe46f8 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 d027e8ee2501..e0268612626e 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 f3c4f5b3484f..60e645a7c29e 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 53b55b9e5bbc..ef59606a2390 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 685463c894dc..02f1453ede59 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 39f12506cda4..4a48abbe6915 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 7075bf56aa58..f5d45d7e1739 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 026da6b2935c..6eb0a114ca32 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 c20c12b9926b..33820e467c3b 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 39c34534ebd9..923581d0fbee 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); |