[Libreoffice-commits] core.git: Branch 'feature/cp-5.0-cairo-svp' - 4 commits - basebmp/source basebmp/test desktop/source drawinglayer/source include/basebmp sw/qa vcl/qa vcl/unx
Caolán McNamara
caolanm at redhat.com
Sat May 21 23:00:52 UTC 2016
basebmp/source/bitmapdevice.cxx | 25 ++------
basebmp/test/basictest.cxx | 39 ++++++--------
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 --
desktop/source/lib/init.cxx | 2
drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 1
include/basebmp/bitmapdevice.hxx | 9 +--
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2
vcl/qa/cppunit/BitmapFilterTest.cxx | 4 -
vcl/qa/cppunit/BitmapTest.cxx | 22 +++----
vcl/unx/gtk/window/gtksalframe.cxx | 6 +-
16 files changed, 70 insertions(+), 121 deletions(-)
New commits:
commit 971f2e4bcd411a358c4e5731fc0ff83b420346b3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 23 11:04:26 2015 +0000
updae getTileMode
Change-Id: Ic8d67f08d40f475020c0534570fe3bea07aa431b
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d3b5879..b03d00f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1081,7 +1081,7 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
{
- return LOK_TILEMODE_RGBA;
+ return LOK_TILEMODE_BGRA;
}
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
commit 95452fc8f29e1bcf5694788a08b7099bb56c7bba
Author: Caolán McNamara <caolanm at 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 <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 4ef38f0..2710fb84 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 293fbe5..14c0fe4 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 611e189..8580b80 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 30644fb..1f051ae 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 13ad48c..8526964 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 875a27d..067ec24 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 731158e..f6a3909 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 7b4559c..d53ba72 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 60746d7..a0371eb 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 5953741..6071c79 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 c6f372a..3ec5d0c 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 b69eabc..c594945 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);
commit d0c6ea67b48bf1cde719175b4afba1f769b37726
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 27 16:10:10 2015 +0000
Resolves: rhbz#1283426 using vdevs based on now dead physical devs is unsafe
This is the same problem that
commit 133e04fc1a870c0aad207e82eefeeeceaba5dc6d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 17 09:23:32 2015 +0100
Resolves: tdf#91880 Invalidate graphics when the gtk window is destroyed
not just when the GtkSalFrame is dtored
tried to fix, but that just made it more unlikely to fail
Change-Id: Icba750c787adb6cd5c5ed0874ef07e6201c4cf25
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index ccf6d30..eb254bd 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -185,6 +185,7 @@ namespace
if(!pRetval)
{
pRetval = VclPtr<VirtualDevice>::Create(rOutDev, bMonoChrome ? DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR);
+ maDeviceTemplates[pRetval] = &rOutDev;
pRetval->SetOutputSizePixel(rSizePixel, bClear);
}
else
commit 8626cafa3a08088fb310fe6ecf2906208e068a3a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri May 20 11:23:06 2016 +0200
cairo svp: Sync the vcl unit tests with master.
BitmapTest.cxx was copied from master and adapted. BitmapFilterTest.cxx was
removed in master, so I just updated the expected values.
Change-Id: I8d6c158115d4a64e4336e7f83163aa5aaeef8a17
diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx
index e0cf3ef..a8e7129 100644
--- a/vcl/qa/cppunit/BitmapFilterTest.cxx
+++ b/vcl/qa/cppunit/BitmapFilterTest.cxx
@@ -102,8 +102,8 @@ void BitmapFilterTest::testBlurCorrectness()
}
// Check blurred bitmap parameters
- CPPUNIT_ASSERT_EQUAL(static_cast<long>(45), aBitmap24Bit.GetSizePixel().Width());
- CPPUNIT_ASSERT_EQUAL(static_cast<long>(35), aBitmap24Bit.GetSizePixel().Height());
+ CPPUNIT_ASSERT_EQUAL(static_cast<long>(41), aBitmap24Bit.GetSizePixel().Width());
+ CPPUNIT_ASSERT_EQUAL(static_cast<long>(31), aBitmap24Bit.GetSizePixel().Height());
CPPUNIT_ASSERT_EQUAL(nBPP, aBitmap24Bit.GetBitCount());
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index a5437c1..69f030e 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -51,17 +51,13 @@ void BitmapTest::testConvert()
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), pReadAccess->GetBitCount());
-#if defined WNT
+#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
if (!OpenGLHelper::isVCLOpenGLEnabled())
- {
- // GDI Scanlines padded to DWORD multiples, it seems
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(12), pReadAccess->GetScanlineSize());
- }
- else
#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()));
@@ -74,13 +70,13 @@ void BitmapTest::testConvert()
CPPUNIT_ASSERT_EQUAL(sal_uInt16(24), aBitmap.GetBitCount());
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
-#if defined LINUX
- // 24 bit Bitmap on SVP backend uses 32bit BGRX format
+#if defined LINUX || defined FREEBSD
+ // 24 bit Bitmap on SVP backend uses 32bit BGRA format
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(32), pReadAccess->GetBitCount());
CPPUNIT_ASSERT_EQUAL(sal_uLong(40), pReadAccess->GetScanlineSize());
#else
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), pReadAccess->GetBitCount());
-#if defined WNT
+#if defined(_WIN32)
if (!OpenGLHelper::isVCLOpenGLEnabled())
{
// GDI Scanlines padded to DWORD multiples, it seems
@@ -178,7 +174,7 @@ void BitmapTest::testCRC()
{
CRCHash aCRCs;
- Bitmap aBitmap(Size(1023,759), 24, 0);
+ Bitmap aBitmap(Size(1023,759), 24, nullptr);
aBitmap.Erase(COL_BLACK);
checkAndInsert(aCRCs, aBitmap, "black bitmap");
aBitmap.Invert();
@@ -188,7 +184,7 @@ void BitmapTest::testCRC()
aVDev->SetBackground(Wallpaper(COL_WHITE));
aVDev->SetOutputSizePixel(Size(1023, 759));
-#if 0 // disabled for now - it breaks on OS/X and Windows
+#if 0 // disabled for now - oddly breaks on OS/X - but why ?
Bitmap aWhiteCheck = getAsBitmap(aVDev);
CPPUNIT_ASSERT(aCRCs.find(aWhiteCheck.GetChecksum()) != aCRCs.end());
#endif
More information about the Libreoffice-commits
mailing list