drop now unused basebmp xor mode

Change-Id: If4d1a933f5ebf2154c377ef9a8596eb0962d43d3
This commit is contained in:
Caolán McNamara
2016-01-16 21:14:19 +00:00
parent 08611cf8bf
commit a9fb9929a1
13 changed files with 184 additions and 500 deletions

View File

@@ -294,14 +294,10 @@ namespace
colorblend_accessor_type maColorBlendAccessor;
colorblend_generic_accessor_type maGenericColorBlendAccessor;
raw_accessor_type maRawAccessor;
xor_accessor_type maXorAccessor;
raw_xor_accessor_type maRawXorAccessor;
masked_accessor_type maMaskedAccessor;
masked_colorblend_accessor_type maMaskedColorBlendAccessor;
masked_colorblend_generic_accessor_type maGenericMaskedColorBlendAccessor;
masked_xoraccessor_type maMaskedXorAccessor;
raw_maskedaccessor_type maRawMaskedAccessor;
raw_maskedxor_accessor_type maRawMaskedXorAccessor;
raw_maskedmask_accessor_type maRawMaskedMaskAccessor;
@@ -326,14 +322,10 @@ namespace
maColorBlendAccessor( accessor ),
maGenericColorBlendAccessor( accessor ),
maRawAccessor( rawAccessor ),
maXorAccessor( accessor ),
maRawXorAccessor( rawAccessor ),
maMaskedAccessor( accessor ),
maMaskedColorBlendAccessor( maColorBlendAccessor ),
maGenericMaskedColorBlendAccessor( maGenericColorBlendAccessor ),
maMaskedXorAccessor( accessor ),
maRawMaskedAccessor( rawAccessor ),
maRawMaskedXorAccessor( rawAccessor ),
maRawMaskedMaskAccessor( rawAccessor )
{}
@@ -388,23 +380,16 @@ namespace
}
virtual void setPixel_i( const basegfx::B2IPoint& rPt,
Color pixelColor,
DrawMode drawMode ) override
Color pixelColor ) override
{
const DestIterator pixel( maBegin +
vigra::Diff2D(rPt.getX(),
rPt.getY()) );
if( drawMode == DrawMode::XOR )
maXorAccessor.set( pixelColor,
pixel );
else
maAccessor.set( pixelColor,
pixel );
maAccessor.set( pixelColor, pixel );
}
virtual void setPixel_i( const basegfx::B2IPoint& rPt,
Color pixelColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) override
{
std::shared_ptr<mask_bitmap_type> pMask( getCompatibleClipMask(rClip) );
@@ -417,12 +402,8 @@ namespace
maBegin + offset,
pMask->maBegin + offset );
if( drawMode == DrawMode::XOR )
maMaskedXorAccessor.set( pixelColor,
aIter );
else
maMaskedAccessor.set( pixelColor,
aIter );
maMaskedAccessor.set( pixelColor,
aIter );
}
virtual Color getPixel_i(const basegfx::B2IPoint& rPt ) override
@@ -473,33 +454,26 @@ namespace
rawAcc );
}
template< typename Iterator, typename RawAcc, typename XorAcc >
template< typename Iterator, typename RawAcc >
void implDrawLine( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
const basegfx::B2IBox& rBounds,
Color col,
const Iterator& begin,
const RawAcc& rawAcc,
const XorAcc& xorAcc,
DrawMode drawMode )
const RawAcc& rawAcc )
{
if( drawMode == DrawMode::XOR )
implRenderLine( rPt1, rPt2, rBounds, col,
begin, maAccessor, xorAcc );
else
implRenderLine( rPt1, rPt2, rBounds, col,
begin, maAccessor, rawAcc );
implRenderLine( rPt1, rPt2, rBounds, col,
begin, maAccessor, rawAcc );
}
virtual void drawLine_i(const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode ) override
Color lineColor ) override
{
implDrawLine(rPt1,rPt2,rBounds,lineColor,
maBegin,
maRawAccessor,maRawXorAccessor,drawMode);
maRawAccessor);
}
composite_iterator_type getMaskedIter( const BitmapDeviceSharedPtr& rClip ) const
@@ -515,13 +489,11 @@ namespace
const basegfx::B2IPoint& rPt2,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) override
{
implDrawLine(rPt1,rPt2,rBounds,lineColor,
getMaskedIter(rClip),
maRawMaskedAccessor,
maRawMaskedXorAccessor,drawMode);
maRawMaskedAccessor);
}
template< typename Iterator, typename RawAcc >
@@ -558,33 +530,21 @@ namespace
virtual void drawPolygon_i(const basegfx::B2DPolygon& rPoly,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode ) override
Color lineColor ) override
{
if( drawMode == DrawMode::XOR )
implDrawPolygon( rPoly, rBounds, lineColor,
maBegin,
maRawXorAccessor );
else
implDrawPolygon( rPoly, rBounds, lineColor,
maBegin,
maRawAccessor );
implDrawPolygon( rPoly, rBounds, lineColor,
maBegin,
maRawAccessor );
}
virtual void drawPolygon_i(const basegfx::B2DPolygon& rPoly,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) override
{
if( drawMode == DrawMode::XOR )
implDrawPolygon( rPoly, rBounds, lineColor,
getMaskedIter(rClip),
maRawMaskedXorAccessor );
else
implDrawPolygon( rPoly, rBounds, lineColor,
getMaskedIter(rClip),
maRawMaskedAccessor );
implDrawPolygon( rPoly, rBounds, lineColor,
getMaskedIter(rClip),
maRawMaskedAccessor );
}
template< typename Iterator, typename RawAcc >
@@ -609,37 +569,23 @@ namespace
virtual void fillPolyPolygon_i(const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const basegfx::B2IBox& rBounds ) override
{
if( drawMode == DrawMode::XOR )
implFillPolyPolygon( rPoly, fillColor,
maBegin,
maRawXorAccessor,
rBounds );
else
implFillPolyPolygon( rPoly, fillColor,
maBegin,
maRawAccessor,
rBounds );
implFillPolyPolygon( rPoly, fillColor,
maBegin,
maRawAccessor,
rBounds );
}
virtual void fillPolyPolygon_i(const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const basegfx::B2IBox& rBounds,
const BitmapDeviceSharedPtr& rClip ) override
{
if( drawMode == DrawMode::XOR )
implFillPolyPolygon( rPoly, fillColor,
getMaskedIter(rClip),
maRawMaskedXorAccessor,
rBounds );
else
implFillPolyPolygon( rPoly, fillColor,
getMaskedIter(rClip),
maRawMaskedAccessor,
rBounds );
implFillPolyPolygon( rPoly, fillColor,
getMaskedIter(rClip),
maRawMaskedAccessor,
rBounds );
}
template< typename Iterator, typename RawAcc >
@@ -733,16 +679,11 @@ namespace
virtual void drawBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode ) override
const basegfx::B2IBox& rDstRect ) override
{
if( isCompatibleBitmap( rSrcBitmap ) )
{
if( drawMode == DrawMode::XOR )
implDrawBitmap(rSrcBitmap, rSrcRect, rDstRect,
maBegin,
maRawXorAccessor);
else if (bitsPerPixel[getScanlineFormat()] >= 8
if (bitsPerPixel[getScanlineFormat()] >= 8
&& rSrcRect.getWidth() == rDstRect.getWidth() && rSrcRect.getHeight() == rDstRect.getHeight()
&& rSrcBitmap->getScanlineFormat() == getScanlineFormat())
implDrawBitmapDirect(rSrcBitmap, rSrcRect, rDstRect);
@@ -753,44 +694,28 @@ namespace
}
else
{
if( drawMode == DrawMode::XOR )
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
maBegin,
maXorAccessor);
else
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
maBegin,
maAccessor);
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
maBegin,
maAccessor);
}
}
virtual void drawBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) override
{
if( isCompatibleBitmap( rSrcBitmap ) )
{
if( drawMode == DrawMode::XOR )
implDrawBitmap(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maRawMaskedXorAccessor);
else
implDrawBitmap(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maRawMaskedAccessor);
implDrawBitmap(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maRawMaskedAccessor);
}
else
{
if( drawMode == DrawMode::XOR )
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedXorAccessor);
else
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
implDrawBitmapGeneric(rSrcBitmap, rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
}
}
@@ -970,35 +895,22 @@ namespace
virtual void drawMaskedBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode ) override
const basegfx::B2IBox& rDstRect ) override
{
if( isCompatibleClipMask(rMask) &&
isCompatibleBitmap(rSrcBitmap) )
{
if( drawMode == DrawMode::XOR )
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maXorAccessor);
else
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maAccessor);
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maAccessor);
}
else
{
if( drawMode == DrawMode::XOR )
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maXorAccessor);
else
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maAccessor);
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
maBegin,
maAccessor);
}
}
@@ -1006,35 +918,22 @@ namespace
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) override
{
if( isCompatibleClipMask(rMask) &&
isCompatibleBitmap(rSrcBitmap) )
{
if( drawMode == DrawMode::XOR )
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedXorAccessor);
else
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
implDrawMaskedBitmap(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
}
else
{
if( drawMode == DrawMode::XOR )
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedXorAccessor);
else
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
implDrawMaskedBitmapGeneric(rSrcBitmap, rMask,
rSrcRect, rDstRect,
getMaskedIter(rClip),
maMaskedAccessor);
}
}
};
@@ -1163,30 +1062,28 @@ void BitmapDevice::clear( Color fillColor )
}
void BitmapDevice::setPixel( const basegfx::B2IPoint& rPt,
Color lineColor,
DrawMode drawMode )
Color lineColor )
{
if( mpImpl->maBounds.isInside(rPt) )
setPixel_i(rPt,lineColor,drawMode);
setPixel_i(rPt,lineColor);
}
void BitmapDevice::setPixel( const basegfx::B2IPoint& rPt,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
setPixel(rPt,lineColor,drawMode);
setPixel(rPt,lineColor);
return;
}
if( mpImpl->maBounds.isInside(rPt) )
{
if( isCompatibleClipMask( rClip ) )
setPixel_i(rPt,lineColor,drawMode,rClip);
setPixel_i(rPt,lineColor,rClip);
else
getGenericRenderer()->setPixel( rPt, lineColor, drawMode, rClip );
getGenericRenderer()->setPixel( rPt, lineColor, rClip );
}
}
@@ -1208,25 +1105,22 @@ sal_uInt32 BitmapDevice::getPixelData( const basegfx::B2IPoint& rPt )
void BitmapDevice::drawLine( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
Color lineColor,
DrawMode drawMode )
Color lineColor )
{
drawLine_i( rPt1,
rPt2,
mpImpl->maBounds,
lineColor,
drawMode );
lineColor );
}
void BitmapDevice::drawLine( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
drawLine(rPt1,rPt2,lineColor,drawMode);
drawLine(rPt1,rPt2,lineColor);
return;
}
@@ -1235,32 +1129,29 @@ void BitmapDevice::drawLine( const basegfx::B2IPoint& rPt1,
rPt2,
mpImpl->maBounds,
lineColor,
drawMode,
rClip );
else
getGenericRenderer()->drawLine( rPt1, rPt2, lineColor,
drawMode, rClip );
rClip );
}
void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly,
Color lineColor,
DrawMode drawMode )
Color lineColor )
{
const sal_uInt32 numVertices( rPoly.count() );
if( numVertices )
drawPolygon_i( rPoly,
mpImpl->maBounds,
lineColor, drawMode );
lineColor );
}
void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
drawPolygon(rPoly,lineColor,drawMode);
drawPolygon(rPoly,lineColor);
return;
}
@@ -1270,36 +1161,34 @@ void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly,
if( isCompatibleClipMask( rClip ) )
drawPolygon_i( rPoly,
mpImpl->maBounds,
lineColor, drawMode, rClip );
lineColor, rClip );
else
getGenericRenderer()->drawPolygon( rPoly, lineColor,
drawMode, rClip );
rClip );
}
}
void BitmapDevice::fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode )
Color fillColor )
{
fillPolyPolygon_i( rPoly, fillColor, drawMode, mpImpl->maBounds );
fillPolyPolygon_i( rPoly, fillColor, mpImpl->maBounds );
}
void BitmapDevice::fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
fillPolyPolygon(rPoly,fillColor,drawMode);
fillPolyPolygon(rPoly,fillColor);
return;
}
if( isCompatibleClipMask( rClip ) )
fillPolyPolygon_i( rPoly, fillColor, drawMode, mpImpl->maBounds, rClip );
fillPolyPolygon_i( rPoly, fillColor, mpImpl->maBounds, rClip );
else
getGenericRenderer()->fillPolyPolygon( rPoly, fillColor,
drawMode, rClip );
rClip );
}
@@ -1450,8 +1339,7 @@ namespace
void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode )
const basegfx::B2IBox& rDstRect )
{
const basegfx::B2IVector& rSrcSize( rSrcBitmap->getSize() );
const basegfx::B2IBox aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() );
@@ -1466,19 +1354,18 @@ void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
assertImageRange(aDestRange,mpImpl->maBounds);
assertImageRange(aSrcRange,aSrcBounds);
drawBitmap_i( rSrcBitmap, aSrcRange, aDestRange, drawMode );
drawBitmap_i( rSrcBitmap, aSrcRange, aDestRange );
}
}
void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
drawBitmap(rSrcBitmap,rSrcRect,rDstRect,drawMode);
drawBitmap(rSrcBitmap,rSrcRect,rDstRect);
return;
}
@@ -1497,12 +1384,12 @@ void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
if( isCompatibleClipMask( rClip ) )
{
drawBitmap_i( rSrcBitmap, aSrcRange, aDestRange, drawMode, rClip );
drawBitmap_i( rSrcBitmap, aSrcRange, aDestRange, rClip );
}
else
{
getGenericRenderer()->drawBitmap( rSrcBitmap, rSrcRect,
rDstRect, drawMode, rClip );
rDstRect, rClip );
}
}
}
@@ -1539,8 +1426,7 @@ void BitmapDevice::drawMaskedColor( Color aSrcColor,
aSize );
pAlphaCopy->drawBitmap(rAlphaMask,
aSrcRange,
aAlphaRange,
DrawMode::Paint);
aAlphaRange);
drawMaskedColor_i( aSrcColor, pAlphaCopy, aAlphaRange, aDestPoint );
}
else
@@ -1591,8 +1477,7 @@ void BitmapDevice::drawMaskedColor( Color aSrcColor,
aSize );
pAlphaCopy->drawBitmap(rAlphaMask,
aSrcRange,
aAlphaRange,
DrawMode::Paint);
aAlphaRange);
drawMaskedColor_i( aSrcColor, pAlphaCopy, aAlphaRange, aDestPoint, rClip );
}
else
@@ -1611,8 +1496,7 @@ void BitmapDevice::drawMaskedColor( Color aSrcColor,
void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode )
const basegfx::B2IBox& rDstRect )
{
OSL_ASSERT( rMask->getSize() == rSrcBitmap->getSize() );
@@ -1629,7 +1513,7 @@ void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
assertImageRange(aDestRange,mpImpl->maBounds);
assertImageRange(aSrcRange,aSrcBounds);
drawMaskedBitmap_i( rSrcBitmap, rMask, aSrcRange, aDestRange, drawMode );
drawMaskedBitmap_i( rSrcBitmap, rMask, aSrcRange, aDestRange );
}
}
@@ -1637,12 +1521,11 @@ void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip )
{
if( !rClip )
{
drawMaskedBitmap(rSrcBitmap,rMask,rSrcRect,rDstRect,drawMode);
drawMaskedBitmap(rSrcBitmap,rMask,rSrcRect,rDstRect);
return;
}
@@ -1663,12 +1546,12 @@ void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
if( isCompatibleClipMask( rClip ) )
{
drawMaskedBitmap_i( rSrcBitmap, rMask, aSrcRange, aDestRange, drawMode, rClip );
drawMaskedBitmap_i( rSrcBitmap, rMask, aSrcRange, aDestRange, rClip );
}
else
{
getGenericRenderer()->drawMaskedBitmap( rSrcBitmap, rMask, rSrcRect,
rDstRect, drawMode, rClip );
rDstRect, rClip );
}
}
}

View File

@@ -159,7 +159,7 @@ public:
sal_uInt32(0), pDevice->getPixelData(aPt));
const Color aCol(0xFFFFFFFF);
pDevice->setPixel( aPt, aCol, DrawMode::Paint );
pDevice->setPixel( aPt, aCol );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #1",
aCol, pDevice->getPixel(aPt));
CPPUNIT_ASSERT_EQUAL_MESSAGE("getPixelData for white pixel",
@@ -167,28 +167,28 @@ public:
const basegfx::B2IPoint aPt2(0,0);
const Color aCol2(0xFFFFFFFF);
pDevice->setPixel( aPt2, aCol2, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol2 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #2",
aCol2, pDevice->getPixel(aPt2));
const basegfx::B2IPoint aPt3(aSize.getX()-1,aSize.getY()-1);
const Color aCol3(0x00000000);
pDevice->setPixel( aPt3, aCol3, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol3 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #3",
aCol3, pDevice->getPixel(aPt3));
pDevice->setPixel( aPt3, aCol2, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol2 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #3.5",
aCol2, pDevice->getPixel(aPt3));
const basegfx::B2IPoint aPt4(-100000,-100000);
pDevice->setPixel( aPt4, aCol3, DrawMode::Paint );
pDevice->setPixel( aPt4, aCol3 );
const basegfx::B2IPoint aPt5(100000,100000);
pDevice->setPixel( aPt5, aCol3, DrawMode::Paint );
pDevice->setPixel( aPt5, aCol3 );
auto nPixel(countPixel(pDevice, aCol2));
const basegfx::B2IPoint aPt6(aSize.getX(),aSize.getY());
pDevice->setPixel( aPt6, aCol2, DrawMode::Paint );
pDevice->setPixel( aPt6, aCol2 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("setPixel clipping",
nPixel, countPixel(pDevice, aCol2));
@@ -201,16 +201,16 @@ public:
true,
Format::OneBitLsbPal );
pDevice->setPixel( aPt2, aCol, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #4",
aCol, pDevice->getPixel(aPt2));
const basegfx::B2IPoint aPt222(1,1);
pDevice->setPixel( aPt222, aCol, DrawMode::Paint );
pDevice->setPixel( aPt222, aCol );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #5",
aCol, pDevice->getPixel(aPt222));
pDevice->setPixel( aPt3, aCol, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #6",
aCol, pDevice->getPixel(aPt3));
@@ -227,17 +227,17 @@ public:
Format::EightBitGrey );
const Color aCol4(0x010101);
pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
pDevice->setPixel( aPt, aCol4 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #4",
aCol4, pDevice->getPixel(aPt));
const Color aCol5(0x0F0F0F);
pDevice->setPixel( aPt2, aCol5, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol5 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #5",
aCol5, pDevice->getPixel(aPt2));
const Color aCol6(0xFFFFFF);
pDevice->setPixel( aPt3, aCol6, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol6 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #6",
aCol6, pDevice->getPixel(aPt3));
}
@@ -251,17 +251,17 @@ public:
pDevice->clear( aCol7 );
const Color aCol4(0x00101010);
pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
pDevice->setPixel( aPt, aCol4 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #7",
aCol4, pDevice->getPixel(aPt));
const Color aCol5(0x00F0F0F0);
pDevice->setPixel( aPt2, aCol5, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol5 );
CPPUNIT_ASSERT_MESSAGE("get/setPixel roundtrip #8",
pDevice->getPixel(aPt2) != aCol7);
const Color aCol6(0x00FFFFFF);
pDevice->setPixel( aPt3, aCol6, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol6 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #9",
aCol6, pDevice->getPixel(aPt3));
}
@@ -273,17 +273,17 @@ public:
Format::TwentyFourBitTcMask );
const Color aCol4(0x01010101);
pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
pDevice->setPixel( aPt, aCol4 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #10",
aCol4, pDevice->getPixel(aPt));
const Color aCol5(0x0F3F2F1F);
pDevice->setPixel( aPt2, aCol5, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol5 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #11",
aCol5, pDevice->getPixel(aPt2));
const Color aCol6(0xFFFFFFFF);
pDevice->setPixel( aPt3, aCol6, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol6 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #12",
aCol6, pDevice->getPixel(aPt3));
@@ -302,17 +302,17 @@ public:
Format::ThirtyTwoBitTcMaskBGRA );
const Color aCol4(0x01010101);
pDevice->setPixel( aPt, aCol4, DrawMode::Paint );
pDevice->setPixel( aPt, aCol4 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #13",
aCol4, pDevice->getPixel(aPt));
const Color aCol5(0x0F0F0F0F);
pDevice->setPixel( aPt2, aCol5, DrawMode::Paint );
pDevice->setPixel( aPt2, aCol5 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #14",
aCol5, pDevice->getPixel(aPt2));
const Color aCol6(0xFFFFFFFF);
pDevice->setPixel( aPt3, aCol6, DrawMode::Paint );
pDevice->setPixel( aPt3, aCol6 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("get/setPixel roundtrip #15",
aCol6, pDevice->getPixel(aPt3));
}

View File

@@ -60,8 +60,7 @@ private:
rBmp,
mpMaskBmp1bpp,
aSourceRect,
aDestAll,
DrawMode::Paint );
aDestAll);
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 30",
countPixel( rDevice, aCol ) == 30);
}
@@ -79,8 +78,7 @@ private:
rBmp,
mpMaskBmp1bpp,
aSourceRect,
aDestLeftTop,
DrawMode::Paint );
aDestLeftTop );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 12",
countPixel( rDevice, aCol ) == 12);
}
@@ -115,12 +113,10 @@ public:
const Color aColBlack(0);
mpBmp1bpp->fillPolyPolygon(
aPoly,
aColWhite,
DrawMode::Paint );
aColWhite );
mpBmp32bpp->fillPolyPolygon(
aPoly,
aColWhite,
DrawMode::Paint );
aColWhite );
aSvg = "m 0 0 h6 v10 h-6z" ;
@@ -129,8 +125,7 @@ public:
mpMaskBmp1bpp->clear(aColWhite);
mpMaskBmp1bpp->fillPolyPolygon(
aPoly,
aColBlack,
DrawMode::Paint );
aColBlack );
}
void testBmpBasics()
@@ -173,8 +168,7 @@ public:
basegfx::B2DPolyPolygon aPoly;
basegfx::tools::importFromSvgD( aPoly, "m 2 2 h4 v8 h-4z",
false, nullptr );
xMask->fillPolyPolygon( aPoly, basebmp::Color( 0xff, 0xff, 0xff ),
DrawMode::Paint );
xMask->fillPolyPolygon( aPoly, basebmp::Color( 0xff, 0xff, 0xff ) );
xBitmap = createBitmapDevice( aSize, false,
Format::ThirtyTwoBitTcMaskBGRA );
@@ -192,8 +186,7 @@ public:
xOutput->drawMaskedBitmap(
xBitmap, xMask,
aSourceRect, aDestAll,
DrawMode::Paint );
aSourceRect, aDestAll );
CPPUNIT_ASSERT_MESSAGE( "output not cleared to white",
xOutput->getPixel( basegfx::B2IPoint( 0, 0 ) ) == Color(0xffffff) );

View File

@@ -61,32 +61,28 @@ private:
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftTop,
DrawMode::Paint );
aDestLeftTop );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 8",
countPixel( rDevice, aCol ) == 8);
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightTop,
DrawMode::Paint );
aDestRightTop );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 16",
countPixel( rDevice, aCol ) == 16);
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftBottom,
DrawMode::Paint );
aDestLeftBottom );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 24",
countPixel( rDevice, aCol ) == 24);
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightBottom,
DrawMode::Paint );
aDestRightBottom );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 32",
countPixel( rDevice, aCol ) == 32);
@@ -100,8 +96,7 @@ private:
rBmp->drawBitmap(
pClone,
aSourceOverlap,
aDestOverlap,
DrawMode::Paint );
aDestOverlap );
CPPUNIT_ASSERT_MESSAGE("clobbertest - number of set pixel is not 50",
countPixel( rBmp, aCol ) == 50);
@@ -122,24 +117,21 @@ private:
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftTop,
DrawMode::Paint );
aDestLeftTop );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4",
countPixel( rDevice, aCol ) == 4);
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestLeftBottom,
DrawMode::Paint );
aDestLeftBottom );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4(c)",
countPixel( rDevice, aCol ) == 4);
rDevice->drawBitmap(
rBmp,
aSourceRect,
aDestRightBottom,
DrawMode::Paint );
aDestRightBottom );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 8",
countPixel( rDevice, aCol ) == 8);
}
@@ -169,12 +161,10 @@ public:
const Color aCol(0xFFFFFFFF);
mpBmp1bpp->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
mpBmp32bpp->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
}
void testBmpBasics()

View File

@@ -53,22 +53,22 @@ private:
const basegfx::B2IPoint aPt(0,0);
const Color aCol(0xFFFFFFFF);
rDevice->setPixel( aPt, aCol, DrawMode::Paint, mpClipMask );
rDevice->setPixel( aPt, aCol, mpClipMask );
CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #1",
rDevice->getPixel(aPt) == aBgCol);
const basegfx::B2IPoint aPt2(10,10);
rDevice->setPixel( aPt2, aCol, DrawMode::Paint, mpClipMask );
rDevice->setPixel( aPt2, aCol, mpClipMask );
CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #2",
rDevice->getPixel(aPt2) == aBgCol);
const basegfx::B2IPoint aPt1(10,0);
rDevice->setPixel( aPt1, aCol, DrawMode::Paint, mpClipMask );
rDevice->setPixel( aPt1, aCol, mpClipMask );
CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #3",
rDevice->getPixel(aPt1) != aBgCol);
const basegfx::B2IPoint aPt3(0,10);
rDevice->setPixel( aPt3, aCol, DrawMode::Paint, mpClipMask );
rDevice->setPixel( aPt3, aCol, mpClipMask );
CPPUNIT_ASSERT_MESSAGE("get/setPixel clip #4",
rDevice->getPixel(aPt3) != aBgCol);
}
@@ -81,7 +81,7 @@ private:
const basegfx::B2IPoint aPt1(0,0);
const basegfx::B2IPoint aPt2(1,9);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint, mpClipMask );
rDevice->drawLine( aPt1, aPt2, aCol, mpClipMask );
const basegfx::B2IPoint aPt3(1,5);
CPPUNIT_ASSERT_MESSAGE("get line pixel",
@@ -89,11 +89,6 @@ private:
CPPUNIT_ASSERT_MESSAGE("number of rendered line pixel is not 4",
countPixel( rDevice,
rDevice->getPixel(aPt3) ) == 4);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::XOR, mpClipMask );
CPPUNIT_ASSERT_MESSAGE("number of xor-rendered line pixel is not 0",
countPixel( rDevice,
rDevice->getPixel(aPt3) ) == 121);
}
void implTestFillClip(const BitmapDeviceSharedPtr& rDevice)
@@ -105,7 +100,6 @@ private:
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode::Paint,
mpClipMask );
const basegfx::B2IPoint aPt(0,10);
CPPUNIT_ASSERT_MESSAGE("number of clipped pixel is not 30",
@@ -113,18 +107,9 @@ private:
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of filled pixel is not 121",
countPixel( rDevice, rDevice->getPixel(aPt) ) == 121);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode::XOR,
mpClipMask );
CPPUNIT_ASSERT_MESSAGE("number of xor-cleared pixel is not 91",
countPixel( rDevice, rDevice->getPixel(aPt) ) == 121-30);
}
void implTestBmpClip(const BitmapDeviceSharedPtr& rDevice)
@@ -135,15 +120,14 @@ private:
Color aCol1(0);
Color aCol2(0xFFFFFFFF);
pBmp->clear(aCol1);
pBmp->setPixel(basegfx::B2IPoint(0,0),aCol2,DrawMode::Paint);
pBmp->setPixel(basegfx::B2IPoint(1,1),aCol2,DrawMode::Paint);
pBmp->setPixel(basegfx::B2IPoint(2,2),aCol2,basebmp::DrawMode::Paint);
pBmp->setPixel(basegfx::B2IPoint(0,0),aCol2);
pBmp->setPixel(basegfx::B2IPoint(1,1),aCol2);
pBmp->setPixel(basegfx::B2IPoint(2,2),aCol2);
rDevice->clear(aCol1);
rDevice->drawBitmap(pBmp,
basegfx::B2IBox(0,0,3,3),
basegfx::B2IBox(-1,-1,4,4),
DrawMode::Paint,
mpClipMask);
const basegfx::B2IPoint aPt(1,1);
@@ -166,8 +150,7 @@ private:
pBmp->clear( basebmp::Color(0) );
pBmp->fillPolyPolygon(
aPoly,
aCol,
basebmp::DrawMode::Paint );
aCol );
const basegfx::B2IBox aSourceRect(0,0,10,10);
const basegfx::B2IPoint aDestLeftTop(0,0);
@@ -204,8 +187,7 @@ public:
mpClipMask->clear(Color(0));
mpClipMask->drawPolygon(
aPoly.getB2DPolygon(0),
Color(0xFFFFFFFF),
DrawMode::Paint );
Color(0xFFFFFFFF) );
}
void testPixelClip()

View File

@@ -54,8 +54,7 @@ private:
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aRect )),
aCol,
DrawMode::Paint );
aCol );
const basegfx::B2IPoint aPt1(1,1);
CPPUNIT_ASSERT_MESSAGE("first pixel set",
@@ -89,24 +88,21 @@ private:
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aEmpty1 )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
countPixel( rDevice, aCol ) == 0);
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aEmpty2 )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
countPixel( rDevice, aCol ) == 0);
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aVertLineLeft )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 11",
countPixel( rDevice, aCol ) == 11);
const basegfx::B2IPoint aPt1(0,0);
@@ -116,8 +112,7 @@ private:
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aVertLineRight )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 22",
countPixel( rDevice, aCol ) == 22);
const basegfx::B2IPoint aPt2(10,10);
@@ -127,8 +122,7 @@ private:
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aHorzLineTop )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 31",
countPixel( rDevice, aCol ) == 31);
const basegfx::B2IPoint aPt3(5,0);
@@ -138,8 +132,7 @@ private:
rDevice->fillPolyPolygon(
basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect( aHorzLineBottom )),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 40",
countPixel( rDevice, aCol ) == 40);
const basegfx::B2IPoint aPt4(5,10);
@@ -152,8 +145,7 @@ private:
basegfx::tools::importFromSvgD( aPoly, aSvg, false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 43",
countPixel( rDevice, aCol ) == 43);
}
@@ -171,36 +163,31 @@ private:
const Color aCol(0xFFFFFFFF);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aLeftTop)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 1",
countPixel( rDevice, aCol ) == 1);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aRightTop)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 2",
countPixel( rDevice, aCol ) == 2);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aLeftBottom)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 3",
countPixel( rDevice, aCol ) == 3);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aRightBottom)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 4",
countPixel( rDevice, aCol ) == 4);
rDevice->fillPolyPolygon( basegfx::B2DPolyPolygon(
basegfx::tools::createPolygonFromRect(aAllOver)),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 121",
countPixel( rDevice, aCol ) == 121);
}

View File

@@ -46,7 +46,7 @@ private:
const basegfx::B2IPoint aPt1(1,1);
const basegfx::B2IPoint aPt2(9,9);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
rDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("first pixel set",
rDevice->getPixel(aPt1) == aCol);
CPPUNIT_ASSERT_MESSAGE("last pixel set",
@@ -61,7 +61,7 @@ private:
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 9",
countPixel( rDevice, aCol ) == 9);
rDevice->drawLine( aPt2, aPt1, aCol, DrawMode::Paint );
rDevice->drawLine( aPt2, aPt1, aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel after "
"reversed paint is not 9",
@@ -75,7 +75,7 @@ private:
const basegfx::B2IPoint aPt1(10,10);
const basegfx::B2IPoint aPt2(0,10);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
rDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("first pixel set",
rDevice->getPixel(aPt1) == aCol);
CPPUNIT_ASSERT_MESSAGE("last pixel set",
@@ -84,7 +84,7 @@ private:
countPixel( rDevice, aCol ) == 11);
rDevice->clear(Color(0));
rDevice->drawLine( aPt2, aPt1, aCol, DrawMode::Paint );
rDevice->drawLine( aPt2, aPt1, aCol );
CPPUNIT_ASSERT_MESSAGE("first pixel set",
rDevice->getPixel(aPt1) == aCol);
CPPUNIT_ASSERT_MESSAGE("last pixel set",
@@ -100,7 +100,7 @@ private:
const basegfx::B2IPoint aPt1(1,1);
const basegfx::B2IPoint aPt2(1,9);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
rDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("first pixel set",
rDevice->getPixel(aPt1) == aCol);
CPPUNIT_ASSERT_MESSAGE("last pixel set",
@@ -125,7 +125,7 @@ private:
const basegfx::B2IPoint aPt1(1,1);
const basegfx::B2IPoint aPt2(3,2);
const Color aCol(0xFFFFFFFF);
rDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
rDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("first pixel set",
rDevice->getPixel(aPt1) == aCol);
CPPUNIT_ASSERT_MESSAGE("second pixel set",
@@ -136,7 +136,7 @@ private:
"reversed paint is not 3",
countPixel( rDevice, aCol ) == 3);
rDevice->drawLine( aPt2, aPt1, aCol, DrawMode::Paint );
rDevice->drawLine( aPt2, aPt1, aCol );
CPPUNIT_ASSERT_MESSAGE("alternate second pixel set",
rDevice->getPixel(basegfx::B2IPoint(2,2)) == aCol);
@@ -171,7 +171,7 @@ public:
pDevice->getPixelData(aPt1) == 0);
const Color aCol(0xFFFFFFFF);
pDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
pDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("only pixel set",
pDevice->getPixelData(aPt1) == 1);
@@ -184,7 +184,7 @@ public:
CPPUNIT_ASSERT_MESSAGE("only pixel cleared",
pDevice->getPixelData(aPt1) == 0);
pDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
pDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("only pixel still cleared",
pDevice->getPixelData(aPt1) == 0);
}

View File

@@ -60,8 +60,7 @@ private:
rDevice->clear(aCol);
rDevice->setPixel(
basegfx::B2IPoint(1,1),
aCol2,
DrawMode::Paint);
aCol2);
rDevice->drawMaskedColor(
aCol2,
rBmp,
@@ -120,8 +119,7 @@ public:
const Color aCol(0xFF);
mpMask->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol);
}
void testMaskBasics()

View File

@@ -57,8 +57,7 @@ private:
"M2 2 l7 7 z", false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
countPixel( rDevice, aCol ) == 0);
@@ -71,8 +70,7 @@ private:
"M7 2 l-6 6 z", false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0(b)",
countPixel( rDevice, aCol ) == 0);
}
@@ -89,8 +87,7 @@ private:
"M2 2 h1 l7 7 h-1 z", false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 7",
countPixel( rDevice, aCol ) == 7);
@@ -103,8 +100,7 @@ private:
"M7 2 h-1 l-6 6 h1 z", false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 6",
countPixel( rDevice, aCol ) == 6);
@@ -117,8 +113,7 @@ private:
"M0 0 l7 7 h-1 l-5-7 z", false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 3",
countPixel( rDevice, aCol ) == 3);
}
@@ -136,8 +131,7 @@ private:
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 40",
countPixel( rDevice, aCol ) == 40);
}
@@ -160,8 +154,7 @@ private:
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 39",
countPixel( rDevice, aCol ) == 39);
@@ -175,8 +168,7 @@ private:
rDevice->clear(aBgCol);
pClippedDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 7",
countPixel( rDevice, aCol ) == 7);
}
@@ -197,47 +189,18 @@ private:
// clippedlinerenderer.hxx, first point not clipped
const basegfx::B2IPoint aPt1(3,3);
const basegfx::B2IPoint aPt2(4,2);
pClippedDevice->drawLine( aPt1, aPt2, aCol, DrawMode::Paint );
pClippedDevice->drawLine( aPt1, aPt2, aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 1",
countPixel( rDevice, aCol ) == 1);
// trigger "alternate bresenham" case in
// clippedlinerenderer.hxx, both start and endpoint clipped
const basegfx::B2IPoint aPt3(0,4);
pClippedDevice->drawLine( aPt3, aPt2, aCol, DrawMode::XOR );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 0",
countPixel( rDevice, aCol ) == 0);
// trigger "standard bresenham" case in
// clippedlinerenderer.hxx, first point not clipped
const basegfx::B2IPoint aPt4(6,2);
pClippedDevice->drawLine( aPt1, aPt4, aCol, DrawMode::Paint );
pClippedDevice->drawLine( aPt1, aPt4, aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 2",
countPixel( rDevice, aCol ) == 2);
// trigger "clipCode1 & aMinFlag/bMinFlag" cases in
// clippedlinerenderer.hxx (note1: needs forcing end point to
// be clipped as well, otherwise optimization kicks in. note2:
// needs forcing end point to clip on two edges, not only on
// one, otherwise swap kicks in)
const basegfx::B2IPoint aPt5(1,1);
const basegfx::B2IPoint aPt6(6,10);
pClippedDevice->drawLine( aPt5, aPt6, aCol, DrawMode::XOR );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 6",
countPixel( rDevice, aCol ) == 6);
// trigger "clipCode1 & (aMinFlag|aMaxFlag)" case in
// clippedlinerenderer.hxx that was not taken for the test
// above
pClippedDevice->drawLine( aPt3, aPt6, aCol, DrawMode::XOR );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 8",
countPixel( rDevice, aCol ) == 8);
}
void implTestPolyDrawClip(const BitmapDeviceSharedPtr& rDevice)
@@ -260,8 +223,7 @@ private:
for( unsigned int i=0; i<aPoly.count(); ++i )
pClippedDevice->drawPolygon(
aPoly.getB2DPolygon(i),
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 7",
countPixel( rDevice, aCol ) == 7);
@@ -283,8 +245,7 @@ private:
false, nullptr );
rDevice->fillPolyPolygon(
aPoly,
aCol,
DrawMode::Paint );
aCol );
CPPUNIT_ASSERT_MESSAGE("number of rendered pixel is not 46",
countPixel( rDevice, aCol ) == 46);
}

View File

@@ -21,7 +21,6 @@
#define INCLUDED_BASEBMP_BITMAPDEVICE_HXX
#include <sal/types.h>
#include <basebmp/drawmodes.hxx>
#include <basebmp/scanlineformats.hxx>
#include <basebmp/basebmpdllapi.h>
@@ -131,13 +130,9 @@ public:
@param pixelColor
Color value to set the pixel to
@param drawMode
Draw mode to use when changing the pixel value
*/
void setPixel( const basegfx::B2IPoint& rPt,
Color pixelColor,
DrawMode drawMode );
Color pixelColor );
/** Set given pixel to specified color
@@ -147,16 +142,12 @@ public:
@param pixelColor
Color value to set the pixel to
@param drawMode
Draw mode to use when changing the pixel value
@param rClip
Clip mask to use. If the clip mask is 1 at the given pixel
position, no change will take place.
*/
void setPixel( const basegfx::B2IPoint& rPt,
Color pixelColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
/** Get color value at given pixel
@@ -184,14 +175,10 @@ public:
@param lineColor
Color value to draw the line with
@param drawMode
Draw mode to use when changing the pixel value
*/
void drawLine( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
Color lineColor,
DrawMode drawMode );
Color lineColor );
/** Draw a line
@@ -207,9 +194,6 @@ public:
@param lineColor
Color value to draw the line with
@param drawMode
Draw mode to use when changing the pixel value
@param rClip
Clip mask to use. Pixel where the corresponding clip mask
pixel is 1 will not be modified.
@@ -217,7 +201,6 @@ public:
void drawLine( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
/** Draw a polygon
@@ -229,13 +212,9 @@ public:
@param lineColor
Color value to draw the polygon with
@param drawMode
Draw mode to use when changing pixel values
*/
void drawPolygon( const basegfx::B2DPolygon& rPoly,
Color lineColor,
DrawMode drawMode );
Color lineColor );
/** Draw a polygon
@@ -247,16 +226,12 @@ public:
@param lineColor
Color value to draw the polygon with
@param drawMode
Draw mode to use when changing pixel values
@param rClip
Clip mask to use. Pixel where the corresponding clip mask
pixel is 1 will not be modified.
*/
void drawPolygon( const basegfx::B2DPolygon& rPoly,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
/** Fill a poly-polygon
@@ -273,13 +248,9 @@ public:
@param fillColor
Color value to fill the poly-polygon with
@param drawMode
Draw mode to use when changing pixel values
*/
void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode );
Color fillColor );
/** Fill a poly-polygon
@@ -296,16 +267,12 @@ public:
@param fillColor
Color value to fill the poly-polygon with
@param drawMode
Draw mode to use when changing pixel values
@param rClip
Clip mask to use. Pixel where the corresponding clip mask
pixel is 1 will not be modified.
*/
void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
/** Draw another bitmap into this device
@@ -328,14 +295,10 @@ public:
fillPolyPolygon(), and using the same rectangle as the
destination rectangle of this method, will affect exactly the
same set of pixel.
@param drawMode
Draw mode to use when changing pixel values
*/
void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode );
const basegfx::B2IBox& rDstRect );
/** Draw another bitmap into this device
@@ -358,9 +321,6 @@ public:
destination rectangle of this method, will affect exactly the
same set of pixel.
@param drawMode
Draw mode to use when changing pixel values
@param rClip
Clip mask to use. Pixel where the corresponding clip mask
pixel is 1 will not be modified.
@@ -368,7 +328,6 @@ public:
void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
/** Draw a color with an alpha-modulation bitmap into this device
@@ -471,15 +430,11 @@ public:
fillPolyPolygon(), and using the same rectangle as the
destination rectangle of this method, will affect exactly the
same set of pixel.
@param drawMode
Draw mode to use when changing pixel values
*/
void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode );
const basegfx::B2IBox& rDstRect );
/** Draw another bitmap through a mask into this device
@@ -513,9 +468,6 @@ public:
destination rectangle of this method, will affect exactly the
same set of pixel.
@param drawMode
Draw mode to use when changing pixel values
@param rClip
Clip mask to use. Pixel where the corresponding clip mask
pixel is 1 will not be modified.
@@ -524,7 +476,6 @@ public:
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip );
protected:
@@ -547,11 +498,9 @@ private:
const basegfx::B2IBox& rBounds ) = 0;
BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
Color lineColor,
DrawMode drawMode ) = 0;
Color lineColor) = 0;
BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) = 0;
BASEBMP_DLLPRIVATE virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
@@ -561,44 +510,36 @@ private:
BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode ) = 0;
Color lineColor ) = 0;
BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
const basegfx::B2IPoint& rPt2,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) = 0;
BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode ) = 0;
Color lineColor ) = 0;
BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
const basegfx::B2IBox& rBounds,
Color lineColor,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) = 0;
BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const basegfx::B2IBox& rBounds ) = 0;
BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
Color fillColor,
DrawMode drawMode,
const basegfx::B2IBox& rBounds,
const BitmapDeviceSharedPtr& rClip ) = 0;
// must work with *this == rSrcBitmap!
BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode ) = 0;
const basegfx::B2IBox& rDstRect ) = 0;
BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) = 0;
// must work with *this == rSrcBitmap!
@@ -616,13 +557,11 @@ private:
BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode ) = 0;
const basegfx::B2IBox& rDstRect ) = 0;
BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
const BitmapDeviceSharedPtr& rMask,
const basegfx::B2IBox& rSrcRect,
const basegfx::B2IBox& rDstRect,
DrawMode drawMode,
const BitmapDeviceSharedPtr& rClip ) = 0;
BitmapDeviceSharedPtr getGenericRenderer() const;

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_BASEBMP_DRAWMODES_HXX
#define INCLUDED_BASEBMP_DRAWMODES_HXX
/* Definition of Draw modes */
namespace basebmp
{
enum class DrawMode
{
/** Default draw mode, which simply renders pixels in the
requested color
*/
Paint,
/** XOR draw mode, which XORs each existing pixel value with
the new color.
The result of this XOR operation strongly depends on the
underlying pixel format, as it is defined by the bitwise
XOR of the (potentially palette-looked-up) color value and
the existing pixel content (be it true color or a
palette index).
*/
XOR
};
}
#endif /* INCLUDED_BASEBMP_DRAWMODES_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -81,7 +81,7 @@ bool SvpSalBitmap::Create( const SalBitmap& rSalBmp )
B2IVector aSize = rSrcBmp->getSize();
m_aBitmap = cloneBitmapDevice( aSize, rSrcBmp );
B2IBox aRect( 0, 0, aSize.getX(), aSize.getY() );
m_aBitmap->drawBitmap( rSrcBmp, aRect, aRect, DrawMode::Paint );
m_aBitmap->drawBitmap(rSrcBmp, aRect, aRect);
}
else
m_aBitmap.reset();

View File

@@ -166,7 +166,7 @@ namespace
assert(aTmpBmp.GetBitCount() == 32);
basegfx::B2IBox aRect(0, 0, aSize.Width(), aSize.Height());
const basebmp::BitmapDeviceSharedPtr& rTmpSrc = aTmpBmp.getBitmap();
rTmpSrc->drawBitmap(rSrcBmp, aRect, aRect, basebmp::DrawMode::Paint );
rTmpSrc->drawBitmap(rSrcBmp, aRect, aRect);
source = SvpSalGraphics::createCairoSurface(rTmpSrc);
}
else