basebmp/source/bitmapdevice.cxx | 27 ++++++-- include/basebmp/bitmapdevice.hxx | 4 + sal/qa/osl/process/osl_Thread.cxx | 128 ++++++++++++++------------------------ vcl/headless/svpgdi.cxx | 3 4 files changed, 77 insertions(+), 85 deletions(-)
New commits: commit 578fd01ee9d1a3b550e115d5db64523c7f57efde Author: Michael Meeks <michael.me...@collabora.com> Date: Tue Oct 14 11:59:04 2014 -0300 basebmp: accelerated method to create a clipping device. This was some staggering proportion of tiled rendering documents with complex clipping; it seems 'clear' is not what memset is for 1bit clip masks. Change-Id: I9142ffb7d7016603feb7782d6f03b9992b9494e3 diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 4104c18..d79afd5 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -1944,7 +1944,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, const basegfx::B2IBox* pSubset, - const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) + const IBitmapDeviceDamageTrackerSharedPtr& rDamage, + bool bBlack = true) { OSL_ASSERT(rSize.getX() > 0 && rSize.getY() > 0); @@ -1990,7 +1991,10 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& &rtl_freeMemory ); if (pMem.get() == 0 && nMemSize != 0) return BitmapDeviceSharedPtr(); - memset(pMem.get(), 0, nMemSize); + if (bBlack) + memset(pMem.get(), 0, nMemSize); + else + memset(pMem.get(), 0xFF, nMemSize); } sal_uInt8* pFirstScanline = nScanlineStride < 0 ? @@ -2129,9 +2133,10 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, const basegfx::B2IBox* pSubset, - const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) + const IBitmapDeviceDamageTrackerSharedPtr& rDamage, + bool bBlack = true) { - BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, bTopDown, nScanlineFormat, pMem, pPal, pSubset, rDamage ) ); + BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, bTopDown, nScanlineFormat, pMem, pPal, pSubset, rDamage, bBlack ) ); #ifdef SAL_LOG_INFO std::ostringstream subset; @@ -2194,6 +2199,20 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize IBitmapDeviceDamageTrackerSharedPtr() ); } +BitmapDeviceSharedPtr createClipDevice( const basegfx::B2IVector& rSize ) +{ + BitmapDeviceSharedPtr xClip( + createBitmapDeviceImpl( rSize, + false, /* bTopDown */ + basebmp::FORMAT_ONE_BIT_MSB_GREY, + boost::shared_array< sal_uInt8 >(), + PaletteMemorySharedVector(), + NULL, + IBitmapDeviceDamageTrackerSharedPtr(), + false /* white */) ); + return xClip; +} + BitmapDeviceSharedPtr subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto, const basegfx::B2IBox& rSubset ) { diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx index 1a81514..a4c38e8 100644 --- a/include/basebmp/bitmapdevice.hxx +++ b/include/basebmp/bitmapdevice.hxx @@ -690,6 +690,10 @@ BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVe const PaletteMemorySharedVector& rPalette ); +/** Function to create a 1 bit grey clipping mask initialized to white. + */ +BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createClipDevice( const basegfx::B2IVector& rSize ); + /** Function to retrieve a subsetted BitmapDevice to the same memory. diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 6f993db..9ad4c7b 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -168,8 +168,7 @@ void SvpSalGraphics::ensureClip() m_aDevice = m_aOrigDevice; basegfx::B2IVector aSize = m_aDevice->getSize(); - m_aClipMap = basebmp::createBitmapDevice( aSize, false, basebmp::FORMAT_ONE_BIT_MSB_GREY ); - m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) ); + m_aClipMap = basebmp::createClipDevice( aSize ); RectangleVector aRectangles; m_aClipRegion.GetRegionRectangles(aRectangles); commit 9f8605b04dfecefabe73035aae50443ad93da878 Author: Michael Meeks <michael.me...@collabora.com> Date: Tue Oct 14 09:41:40 2014 -0300 sal: cleanup unit tests whitespace. Change-Id: If067f755b99480b7b7bd0bd3bb7a71a447794273 diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index cdb5d66..134a4ba 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -1434,13 +1434,9 @@ namespace osl_Thread { public: // initialise your test code values here. - void setUp() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} - void tearDown() SAL_OVERRIDE - { - } + void tearDown() SAL_OVERRIDE {} // insert your test code here. void getPriority_001() @@ -1473,14 +1469,8 @@ namespace osl_Thread #endif } - void getPriority_002() - { - - } - CPPUNIT_TEST_SUITE(getPriority); CPPUNIT_TEST(getPriority_001); - CPPUNIT_TEST(getPriority_002); CPPUNIT_TEST_SUITE_END(); }; // class getPriority @@ -1488,28 +1478,17 @@ namespace osl_Thread { public: // initialise your test code values here. - void setUp() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} - void tearDown() SAL_OVERRIDE - { - } + void tearDown() SAL_OVERRIDE {} - // insert your test code here. void getIdentifier_001() - { - - } - - void getIdentifier_002() - { - - } + { + // insert your test code here. + } CPPUNIT_TEST_SUITE(getIdentifier); CPPUNIT_TEST(getIdentifier_001); - CPPUNIT_TEST(getIdentifier_002); CPPUNIT_TEST_SUITE_END(); }; // class getIdentifier @@ -1518,33 +1497,24 @@ namespace osl_Thread class getCurrentIdentifier : public CppUnit::TestFixture { public: - // initialise your test code values here. - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} + void tearDown() SAL_OVERRIDE {} - // insert your test code here. void getCurrentIdentifier_001() - { - oslThreadIdentifier oId; - OCountThread* pCountThread = new OCountThread; - pCountThread->create(); - pCountThread->setWait(3); - oId = Thread::getCurrentIdentifier(); - oslThreadIdentifier oIdChild = pCountThread->getIdentifier(); - termAndJoinThread(pCountThread); - delete pCountThread; - - CPPUNIT_ASSERT_MESSAGE( - "Get the identifier for the current active thread.", - oId != oIdChild - ); - - } + { + oslThreadIdentifier oId; + OCountThread* pCountThread = new OCountThread; + pCountThread->create(); + pCountThread->setWait(3); + oId = Thread::getCurrentIdentifier(); + oslThreadIdentifier oIdChild = pCountThread->getIdentifier(); + termAndJoinThread(pCountThread); + delete pCountThread; + + CPPUNIT_ASSERT_MESSAGE( + "Get the identifier for the current active thread.", + oId != oIdChild); + } CPPUNIT_TEST_SUITE(getCurrentIdentifier); CPPUNIT_TEST(getCurrentIdentifier_001); @@ -1556,14 +1526,8 @@ namespace osl_Thread class wait : public CppUnit::TestFixture { public: - // initialise your test code values here. - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} + void tearDown() SAL_OVERRIDE {} /** call wait in the run method @@ -1617,23 +1581,35 @@ namespace osl_Thread CPPUNIT_TEST_SUITE_END(); }; // class wait + class cpu_count : public CppUnit::TestFixture + { + public: + void setUp() SAL_OVERRIDE {} + void tearDown() SAL_OVERRIDE {} + + void cpu_count_001() + { + sal_uInt32 nThreads = osl_getCPUThreadCount(); + CPPUNIT_ASSERT(false && nThreads > 0); + } + + CPPUNIT_TEST_SUITE(cpu_count); + CPPUNIT_TEST(cpu_count_001); + CPPUNIT_TEST_SUITE_END(); + }; // class cpu_count + /** osl::Thread::yield method: can not design good test scenario to test up to now */ class yield : public CppUnit::TestFixture { public: - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} + void tearDown() SAL_OVERRIDE {} - // insert your test code here. void yield_001() - { - } + { + // insert your test code here. + } CPPUNIT_TEST_SUITE(yield); CPPUNIT_TEST(yield_001); @@ -1645,14 +1621,8 @@ namespace osl_Thread class schedule : public CppUnit::TestFixture { public: - // initialise your test code values here. - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - } + void setUp() SAL_OVERRIDE {} + void tearDown() SAL_OVERRIDE {} /** The requested thread will get terminate the next time schedule() is called. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits