summaryrefslogtreecommitdiff
path: root/basebmp/test
diff options
context:
space:
mode:
Diffstat (limited to 'basebmp/test')
-rw-r--r--basebmp/test/bmpdemo.cxx39
-rw-r--r--basebmp/test/filltest.cxx28
-rw-r--r--basebmp/test/linetest.cxx18
-rw-r--r--basebmp/test/makefile.mk9
4 files changed, 48 insertions, 46 deletions
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 <vcl/bitmap.hxx>
#include <vcl/bmpacc.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/range/b2irange.hxx>
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/point/b2ipoint.hxx>
@@ -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 <basebmp/scanlineformats.hxx>
#include <basebmp/bitmapdevice.hxx>
#include <basebmp/debug.hxx>
+#include "tools.hxx"
#include <iostream>
#include <fstream>
@@ -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; y<rSize.getY(); ++y )
- for( sal_Int32 x=0; x<rSize.getX(); ++x )
- if( rDevice->getPixel( 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 <basebmp/scanlineformats.hxx>
#include <basebmp/bitmapdevice.hxx>
#include <basebmp/debug.hxx>
+#include "tools.hxx"
#include <iostream>
#include <fstream>
@@ -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; y<rSize.getY(); ++y )
- for( sal_Int32 x=0; x<rSize.getX(); ++x )
- if( rDevice->getPixel( 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) \