summaryrefslogtreecommitdiff
path: root/basebmp
diff options
context:
space:
mode:
Diffstat (limited to 'basebmp')
-rw-r--r--basebmp/inc/basebmp/bitmapdevice.hxx22
-rw-r--r--basebmp/inc/basebmp/clippedlinerenderer.hxx2
-rw-r--r--basebmp/source/bitmapdevice.cxx35
-rw-r--r--basebmp/test/basictest.cxx16
-rw-r--r--basebmp/test/polytest.cxx2
5 files changed, 42 insertions, 35 deletions
diff --git a/basebmp/inc/basebmp/bitmapdevice.hxx b/basebmp/inc/basebmp/bitmapdevice.hxx
index 1e6d73b92923..f97ec4fc8778 100644
--- a/basebmp/inc/basebmp/bitmapdevice.hxx
+++ b/basebmp/inc/basebmp/bitmapdevice.hxx
@@ -664,8 +664,8 @@ private:
/** Factory method to create a BitmapDevice for given scanline format
*/
BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
- bool bTopDown,
- sal_Int32 nScanlineFormat );
+ bool bTopDown,
+ sal_Int32 nScanlineFormat );
/** Factory method to create a BitmapDevice for given scanline format
with the given palette
@@ -675,9 +675,9 @@ BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVe
format.
*/
BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
- bool bTopDown,
- sal_Int32 nScanlineFormat,
- const PaletteMemorySharedVector& rPalette );
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const PaletteMemorySharedVector& rPalette );
/** Factory method to create a BitmapDevice for given scanline format
from the given piece of raw memory and palette
@@ -686,10 +686,10 @@ BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVe
image of the specified area and format.
*/
BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize,
- bool bTopDown,
- sal_Int32 nScanlineFormat,
- const RawMemorySharedArray& rMem,
- const PaletteMemorySharedVector& rPalette );
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
/** Factory method to retrieve a subsetted BitmapDevice to the same
@@ -709,8 +709,8 @@ BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr 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).
*/
-BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize,
- const BitmapDeviceSharedPtr& rProto );
+BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize,
+ const BitmapDeviceSharedPtr& rProto );
}
diff --git a/basebmp/inc/basebmp/clippedlinerenderer.hxx b/basebmp/inc/basebmp/clippedlinerenderer.hxx
index 2fbf2f7acfe0..9969b968ff8a 100644
--- a/basebmp/inc/basebmp/clippedlinerenderer.hxx
+++ b/basebmp/inc/basebmp/clippedlinerenderer.hxx
@@ -200,7 +200,7 @@ inline bool prepareClip( sal_Int32 a1,
template< class Iterator, class Accessor >
void renderClippedLine( basegfx::B2IPoint aPt1,
basegfx::B2IPoint aPt2,
- const basegfx::B2IBox& rClipRect,
+ const basegfx::B2IBox& rClipRect,
typename Accessor::value_type color,
Iterator begin,
Accessor acc,
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 5ac1550df157..c307a4ac55e2 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -1047,23 +1047,11 @@ struct ImplBitmapDevice
maBounds.getWidth()/getHeight() yield the true size of the
device (i.e. the rectangle given by maBounds covers the device
- area under the excluding-bottommost-and-rightmost-pixels fill
- rule)
+ area under the including-the-bottommost-and-rightmost-pixels
+ fill rule)
*/
basegfx::B2IBox maBounds;
- /** Bounds of the device.
-
- maBounds.getWidth()/getHeight() yield the true size of the
- device minus 1 (i.e. the rectangle given by maBounds covers
- the device area under the
- including-the-bottommost-and-rightmost-pixels fill rule).
-
- The member is used to clip line stroking against the device
- bounds.
- */
- basegfx::B2IBox maLineClipRect;
-
/// Scanline format, as provided at the constructor
sal_Int32 mnScanlineFormat;
@@ -1102,7 +1090,6 @@ BitmapDevice::BitmapDevice( const basegfx::B2IBox& rBounds,
mpImpl->mpMem = rMem;
mpImpl->mpPalette = rPalette;
mpImpl->maBounds = rBounds;
- mpImpl->maLineClipRect = rBounds;
mpImpl->mnScanlineFormat = nScanlineFormat;
mpImpl->mnScanlineStride = nScanlineStride;
mpImpl->mpFirstScanline = pFirstScanline;
@@ -1170,7 +1157,7 @@ void BitmapDevice::setPixel( const basegfx::B2IPoint& rPt,
Color lineColor,
DrawMode drawMode )
{
- if( mpImpl->maLineClipRect.isInside(rPt) )
+ if( mpImpl->maBounds.isInside(rPt) )
setPixel_i(rPt,lineColor,drawMode);
}
@@ -1185,7 +1172,7 @@ void BitmapDevice::setPixel( const basegfx::B2IPoint& rPt,
return;
}
- if( mpImpl->maLineClipRect.isInside(rPt) )
+ if( mpImpl->maBounds.isInside(rPt) )
{
if( isCompatibleClipMask( rClip ) )
setPixel_i(rPt,lineColor,drawMode,rClip);
@@ -1196,7 +1183,7 @@ void BitmapDevice::setPixel( const basegfx::B2IPoint& rPt,
Color BitmapDevice::getPixel( const basegfx::B2IPoint& rPt )
{
- if( mpImpl->maLineClipRect.isInside(rPt) )
+ if( mpImpl->maBounds.isInside(rPt) )
return getPixel_i(rPt);
return Color();
@@ -1204,7 +1191,7 @@ Color BitmapDevice::getPixel( const basegfx::B2IPoint& rPt )
sal_uInt32 BitmapDevice::getPixelData( const basegfx::B2IPoint& rPt )
{
- if( mpImpl->maLineClipRect.isInside(rPt) )
+ if( mpImpl->maBounds.isInside(rPt) )
return getPixelData_i(rPt);
return 0;
@@ -1217,7 +1204,7 @@ void BitmapDevice::drawLine( const basegfx::B2IPoint& rPt1,
{
drawLine_i( rPt1,
rPt2,
- mpImpl->maLineClipRect,
+ mpImpl->maBounds,
lineColor,
drawMode );
}
@@ -1237,7 +1224,7 @@ void BitmapDevice::drawLine( const basegfx::B2IPoint& rPt1,
if( isCompatibleClipMask( rClip ) )
drawLine_i( rPt1,
rPt2,
- mpImpl->maLineClipRect,
+ mpImpl->maBounds,
lineColor,
drawMode,
rClip );
@@ -1253,7 +1240,7 @@ void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly,
const sal_uInt32 numVertices( rPoly.count() );
if( numVertices )
drawPolygon_i( rPoly,
- mpImpl->maLineClipRect,
+ mpImpl->maBounds,
lineColor, drawMode );
}
@@ -1273,7 +1260,7 @@ void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly,
{
if( isCompatibleClipMask( rClip ) )
drawPolygon_i( rPoly,
- mpImpl->maLineClipRect,
+ mpImpl->maBounds,
lineColor, drawMode, rClip );
else
getGenericRenderer()->drawPolygon( rPoly, lineColor,
@@ -1858,6 +1845,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector&
const basegfx::B2IBox* pSubset,
const IBitmapDeviceDamageTrackerSharedPtr& rDamage )
{
+ OSL_ASSERT(rSize.getX() > 0 && rSize.getY() > 0);
+
if( nScanlineFormat <= Format::NONE ||
nScanlineFormat > Format::MAX )
return BitmapDeviceSharedPtr();
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx
index 246a25a5e7a1..63292729d419 100644
--- a/basebmp/test/basictest.cxx
+++ b/basebmp/test/basictest.cxx
@@ -116,6 +116,21 @@ public:
(*pDevice->getPalette())[1] == Color(0xFFFFFFFF) );
}
+ void testClone()
+ {
+ const basegfx::B2ISize aSize(101,101);
+ basegfx::B2ISize aSize2(3,3);
+ BitmapDeviceSharedPtr pDevice( createBitmapDevice( aSize,
+ true,
+ Format::ONE_BIT_MSB_PAL ));
+
+ BitmapDeviceSharedPtr pClone( cloneBitmapDevice(
+ aSize2,
+ pDevice ));
+ CPPUNIT_ASSERT_MESSAGE("right size",
+ pClone->getSize() == aSize2 );
+ }
+
void testPixelFuncs()
{
// 1bpp
@@ -288,6 +303,7 @@ public:
CPPUNIT_TEST_SUITE(BasicTest);
CPPUNIT_TEST(colorTest);
CPPUNIT_TEST(testConstruction);
+ CPPUNIT_TEST(testClone);
CPPUNIT_TEST(testPixelFuncs);
CPPUNIT_TEST_SUITE_END();
};
diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx
index 177557cec565..8cc51d4921ee 100644
--- a/basebmp/test/polytest.cxx
+++ b/basebmp/test/polytest.cxx
@@ -192,6 +192,8 @@ private:
BitmapDeviceSharedPtr pClippedDevice(
subsetBitmapDevice( rDevice,
basegfx::B2IBox(3,3,5,8) ));
+ CPPUNIT_ASSERT_MESSAGE("size of subsetted device is not (2,5)",
+ pClippedDevice->getSize() == basegfx::B2IVector(2,5));
rDevice->clear(aBgCol);
pClippedDevice->fillPolyPolygon(