From 6a4ea42a8fa08a8b1016b1481aea47d2f02705e8 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Fri, 2 Jun 2006 07:36:15 +0000 Subject: #i65904# Made drawBitmap/drawMaskedColor functional; added raw access for palette images --- basebmp/test/bmpdemo.cxx | 39 +++++++++++++++++++++++++++++---------- basebmp/test/filltest.cxx | 28 ++++++++++------------------ basebmp/test/linetest.cxx | 18 +++--------------- basebmp/test/makefile.mk | 9 ++++++--- 4 files changed, 48 insertions(+), 46 deletions(-) (limited to 'basebmp/test') diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx index 82fadf8d0b18..b1312a597df1 100644 --- a/basebmp/test/bmpdemo.cxx +++ b/basebmp/test/bmpdemo.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bmpdemo.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-05-31 10:12:13 $ + * last change: $Author: thb $ $Date: 2006-06-02 08:36:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,10 +56,13 @@ #include #include +#include +#include #include #include #include #include +#include #include #include @@ -992,17 +995,33 @@ class TestWindow : public Dialog void TestWindow::Paint( const Rectangle& rRect ) { { - const basegfx::B2ISize aSize(11,11); + const basegfx::B2ISize aSize(10,10); + basebmp::BitmapDeviceSharedPtr pBmp( basebmp::createBitmapDevice( aSize, + true, + basebmp::Format::THIRTYTWO_BIT_TC_MASK )); basebmp::BitmapDeviceSharedPtr pDevice( basebmp::createBitmapDevice( aSize, true, basebmp::Format::THIRTYTWO_BIT_TC_MASK )); - - const basegfx::B2IPoint aPt1(1,1); - const basegfx::B2IPoint aPt2(1,9); - const basebmp::Color aCol(0); - pDevice->clear( aCol ); - const basebmp::Color aCol2(0xFFFFFFFF); - pDevice->drawLine( aPt1, aPt2, aCol2, basebmp::DrawMode_PAINT ); + ::rtl::OUString aSvg = ::rtl::OUString::createFromAscii( + "m 0 0h5v10h5v-5h-10z" ); + + basegfx::B2DPolyPolygon aPoly; + basegfx::tools::importFromSvgD( aPoly, aSvg ); + const basebmp::Color aCol(0xFFFFFFFF); + pBmp->clear(basebmp::Color(0)); + pBmp->fillPolyPolygon( + aPoly, + aCol, + basebmp::DrawMode_PAINT ); + + const basegfx::B2IRange aSourceRect(0,0,11,11); + const basegfx::B2IRange aDestLeftTop(0,0,5,5); + pDevice->clear(basebmp::Color(0)); + pDevice->drawBitmap( + pBmp, + aSourceRect, + aDestLeftTop, + basebmp::DrawMode_PAINT ); } enum{ srcBitDepth=1, dstBitDepth=4 }; diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx index f3025c55e7bb..fcaa08058df7 100644 --- a/basebmp/test/filltest.cxx +++ b/basebmp/test/filltest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: filltest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-05-31 10:12:13 $ + * last change: $Author: thb $ $Date: 2006-06-02 08:36:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -47,6 +47,7 @@ #include #include #include +#include "tools.hxx" #include #include @@ -66,19 +67,6 @@ private: BitmapDeviceSharedPtr mpDevice1bpp; BitmapDeviceSharedPtr mpDevice32bpp; - int countPixel( const BitmapDeviceSharedPtr& rDevice, - Color checkColor ) const - { - int count(0); - const basegfx::B2ISize& rSize( rDevice->getSize() ); - for( sal_Int32 y=0; ygetPixel( basegfx::B2IPoint(x,y) ) == checkColor ) - ++count; - - return count; - } - void implTestRectFill(const BitmapDeviceSharedPtr& rDevice) { rDevice->clear(Color(0)); @@ -170,9 +158,6 @@ private: const basegfx::B2IPoint aPt4(5,10); CPPUNIT_ASSERT_MESSAGE("bottom-middle pixel set", rDevice->getPixel(aPt4) == aCol); - - std::ofstream output("32bpp_test.dump"); - debugDump( rDevice, output ); } void implTestClipping(const BitmapDeviceSharedPtr& rDevice) @@ -247,6 +232,12 @@ public: implTestClipping( mpDevice32bpp ); } + void testCornerCases() + { + implTestCornerCases( mpDevice1bpp ); + implTestCornerCases( mpDevice32bpp ); + } + // Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism. @@ -254,6 +245,7 @@ public: CPPUNIT_TEST_SUITE(FillTest); CPPUNIT_TEST(testRectFill); CPPUNIT_TEST(testClipping); + CPPUNIT_TEST(testCornerCases); CPPUNIT_TEST_SUITE_END(); }; diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index 2a0d4dfa7594..3f4515ebfd72 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -4,9 +4,9 @@ * * $RCSfile: linetest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-05-31 10:12:13 $ + * last change: $Author: thb $ $Date: 2006-06-02 08:36:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -44,6 +44,7 @@ #include #include #include +#include "tools.hxx" #include #include @@ -63,19 +64,6 @@ private: BitmapDeviceSharedPtr mpDevice1bpp; BitmapDeviceSharedPtr mpDevice32bpp; - int countPixel( const BitmapDeviceSharedPtr& rDevice, - Color checkColor ) const - { - int count(0); - const basegfx::B2ISize& rSize( rDevice->getSize() ); - for( sal_Int32 y=0; ygetPixel( basegfx::B2IPoint(x,y) ) == checkColor ) - ++count; - - return count; - } - void implTestBasicDiagonalLines(const BitmapDeviceSharedPtr& rDevice) { rDevice->clear(Color(0)); diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 31518e01ed3a..1ad61ffd7ede 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: thb $ $Date: 2006-05-31 10:12:13 $ +# last change: $Author: thb $ $Date: 2006-06-02 08:36:15 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -65,8 +65,11 @@ CFLAGS += -fno-inline # auto generated Target:tests by codegen.pl SHL1OBJS= \ $(SLO)$/basictest.obj \ + $(SLO)$/bmptest.obj \ $(SLO)$/filltest.obj \ - $(SLO)$/linetest.obj + $(SLO)$/linetest.obj \ + $(SLO)$/masktest.obj \ + $(SLO)$/tools.obj SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ -- cgit v1.2.3