basebmp/source/bitmapdevice.cxx | 466 +----- basebmp/test/basictest.cxx | 44 basebmp/test/bmpmasktest.cxx | 21 basebmp/test/bmptest.cxx | 30 basebmp/test/cliptest.cxx | 40 basebmp/test/filltest.cxx | 39 basebmp/test/linetest.cxx | 18 basebmp/test/masktest.cxx | 6 basebmp/test/polytest.cxx | 63 include/basebmp/bitmapdevice.hxx | 113 - include/basebmp/drawmodes.hxx | 49 sd/source/core/text/textapi.cxx | 70 sd/source/ui/func/fuinsfil.cxx | 21 sfx2/source/doc/objserv.cxx | 4 sw/source/filter/ww8/wrtww8.cxx | 13 sw/source/uibase/ribbar/drawbase.cxx | 5 vcl/headless/svpbmp.cxx | 2 vcl/headless/svpcairotextrender.cxx | 2 vcl/headless/svpframe.cxx | 60 vcl/headless/svpgdi.cxx | 1304 +++++++++--------- vcl/headless/svpinst.cxx | 4 vcl/headless/svpvd.cxx | 50 vcl/inc/headless/svpframe.hxx | 14 vcl/inc/headless/svpgdi.hxx | 45 vcl/inc/headless/svpvd.hxx | 13 vcl/inc/unx/gtk/gtkframe.hxx | 11 vcl/inc/unx/gtk/gtkgdi.hxx | 2 vcl/unx/gtk3/cairo_gtk3_cairo.cxx | 2 vcl/unx/gtk3/gtk3gtkframe.cxx | 107 - vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 15 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 3 31 files changed, 1087 insertions(+), 1549 deletions(-)
New commits: commit da5b1d6d1612ccb01ca480d53cc68be5d13a01ec Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jan 17 20:53:19 2016 +0000 cppcheck: doubleFree Change-Id: I371db988044264b6b1ff95bd7c683d1485430fe8 diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index b768b07..f47970d 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -258,20 +258,20 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) mpDocSh->SetWaitCursor( true ); - SfxMedium* pMedium = new SfxMedium( aFile, StreamMode::READ | StreamMode::NOCREATE ); + std::unique_ptr<SfxMedium> xMedium(new SfxMedium(aFile, StreamMode::READ | StreamMode::NOCREATE)); const SfxFilter* pFilter = nullptr; - SfxGetpApp()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter ); + SfxGetpApp()->GetFilterMatcher().GuessFilter(*xMedium, &pFilter); bool bDrawMode = mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr; bool bInserted = false; if( pFilter ) { - pMedium->SetFilter( pFilter ); + xMedium->SetFilter( pFilter ); aFilterName = pFilter->GetFilterName(); - if( pMedium->IsStorage() || ( pMedium->GetInStream() && SotStorage::IsStorageFile( pMedium->GetInStream() ) ) ) + if( xMedium->IsStorage() || ( xMedium->GetInStream() && SotStorage::IsStorageFile( xMedium->GetInStream() ) ) ) { if ( pFilter->GetServiceName() == "com.sun.star.presentation.PresentationDocument" || pFilter->GetServiceName() == "com.sun.star.drawing.DrawingDocument" ) @@ -279,11 +279,11 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) // Draw, Impress or PowerPoint document // the ownership of the Medium is transferred if( bDrawMode ) - InsSDDinDrMode( pMedium ); + InsSDDinDrMode(xMedium.release()); else - InsSDDinOlMode( pMedium ); + InsSDDinOlMode(xMedium.release()); - // don't delete Medium here, ownership of pMedium has changed in this case + // ownership of pMedium has changed in this case bInserted = true; } } @@ -302,12 +302,12 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) if( bFound ) { if( bDrawMode ) - InsTextOrRTFinDrMode(pMedium); + InsTextOrRTFinDrMode(xMedium.get()); else - InsTextOrRTFinOlMode(pMedium); + InsTextOrRTFinOlMode(xMedium.get()); bInserted = true; - delete pMedium; + xMedium.reset(); } } } @@ -318,7 +318,6 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) { ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR)); aErrorBox->Execute(); - delete pMedium; } } commit d50c0a09a58b5c24a2a484e83004c286fe873205 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jan 17 20:49:20 2016 +0000 cppcheck: nullPointer Change-Id: I2f96d4ea73ccf47b2783ade35890c2dd8e558e5f diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index dff76a7..ef7c360 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -788,7 +788,7 @@ const SfxPoolItem* MSWordExportBase::HasItem( sal_uInt16 nWhich ) const const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const { - const SfxPoolItem* pItem; + assert((m_pISet || m_pChpIter) && "Where is my ItemSet / pChpIter ?"); if (m_pISet) { // if write a EditEngine text, then the WhichIds are greater as @@ -796,16 +796,9 @@ const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const // EditEngine Range nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); OSL_ENSURE(nWhich != 0, "All broken, Impossible"); - pItem = &m_pISet->Get(nWhich); - } - else if( m_pChpIter ) - pItem = &m_pChpIter->GetItem( nWhich ); - else - { - OSL_ENSURE( false, "Where is my ItemSet / pChpIter ?" ); - pItem = nullptr; + return m_pISet->Get(nWhich); } - return *pItem; + return m_pChpIter->GetItem( nWhich ); } WW8_WrPlc1::WW8_WrPlc1( sal_uInt16 nStructSz ) commit 20265785f1faf670ab61f6532e708f6986f7653c Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jan 17 20:43:20 2016 +0000 cppcheck: copyCtorPointerCopying replace custom ref counted thing with a shared_ptr Change-Id: I9d61235e38cc4c708826cf76d9edc2880b4b5ec7 diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx index 39f3ca5..83ff45d 100644 --- a/sd/source/core/text/textapi.cxx +++ b/sd/source/core/text/textapi.cxx @@ -83,16 +83,15 @@ void UndoTextAPIChanged::Redo() struct TextAPIEditSource_Impl { - // needed for "internal" refcounting SdDrawDocument* mpDoc; Outliner* mpOutliner; SvxOutlinerForwarder* mpTextForwarder; - sal_Int32 mnRef; }; class TextAPIEditSource : public SvxEditSource { - TextAPIEditSource_Impl* pImpl; + // refcounted + std::shared_ptr<TextAPIEditSource_Impl> m_xImpl; virtual SvxEditSource* Clone() const override; virtual SvxTextForwarder* GetTextForwarder() override; @@ -100,14 +99,13 @@ class TextAPIEditSource : public SvxEditSource explicit TextAPIEditSource( const TextAPIEditSource& rSource ); public: - explicit TextAPIEditSource(SdDrawDocument* pDoc); - virtual ~TextAPIEditSource(); + explicit TextAPIEditSource(SdDrawDocument* pDoc); void Dispose(); void SetText( OutlinerParaObject& rText ); OutlinerParaObject* CreateText(); OUString GetText(); - SdDrawDocument* GetDoc() { return pImpl->mpDoc; } + SdDrawDocument* GetDoc() { return m_xImpl->mpDoc; } }; const SvxItemPropertySet* ImplGetSdTextPortionPropertyMap() @@ -191,8 +189,7 @@ TextAPIEditSource::TextAPIEditSource( const TextAPIEditSource& rSource ) : SvxEditSource( *this ) { // shallow copy; uses internal refcounting - pImpl = rSource.pImpl; - pImpl->mnRef++; + m_xImpl = rSource.m_xImpl; } SvxEditSource* TextAPIEditSource::Clone() const @@ -206,75 +203,68 @@ void TextAPIEditSource::UpdateData() } TextAPIEditSource::TextAPIEditSource(SdDrawDocument* pDoc) -: pImpl(new TextAPIEditSource_Impl) +: m_xImpl(new TextAPIEditSource_Impl) { - pImpl->mpDoc = pDoc; - pImpl->mpOutliner = nullptr; - pImpl->mpTextForwarder = nullptr; - pImpl->mnRef = 1; -} - -TextAPIEditSource::~TextAPIEditSource() -{ - if (!--pImpl->mnRef) - delete pImpl; + m_xImpl->mpDoc = pDoc; + m_xImpl->mpOutliner = nullptr; + m_xImpl->mpTextForwarder = nullptr; } void TextAPIEditSource::Dispose() { - pImpl->mpDoc=nullptr; - delete pImpl->mpTextForwarder; - pImpl->mpTextForwarder = nullptr; + m_xImpl->mpDoc=nullptr; + delete m_xImpl->mpTextForwarder; + m_xImpl->mpTextForwarder = nullptr; - delete pImpl->mpOutliner; - pImpl->mpOutliner = nullptr; + delete m_xImpl->mpOutliner; + m_xImpl->mpOutliner = nullptr; } SvxTextForwarder* TextAPIEditSource::GetTextForwarder() { - if( !pImpl->mpDoc ) + if(!m_xImpl->mpDoc) return nullptr; // mpDoc == 0 can be used to flag this as disposed - if( !pImpl->mpOutliner ) + if (!m_xImpl->mpOutliner) { //init draw model first - pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT ); - pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); + m_xImpl->mpOutliner = new Outliner(m_xImpl->mpDoc, OUTLINERMODE_TEXTOBJECT); + m_xImpl->mpDoc->SetCalcFieldValueHdl(m_xImpl->mpOutliner); } - if( !pImpl->mpTextForwarder ) - pImpl->mpTextForwarder = new SvxOutlinerForwarder( *pImpl->mpOutliner, false ); + if (!m_xImpl->mpTextForwarder) + m_xImpl->mpTextForwarder = new SvxOutlinerForwarder(*m_xImpl->mpOutliner, false); - return pImpl->mpTextForwarder; + return m_xImpl->mpTextForwarder; } void TextAPIEditSource::SetText( OutlinerParaObject& rText ) { - if ( pImpl->mpDoc ) + if (m_xImpl->mpDoc) { - if( !pImpl->mpOutliner ) + if (!m_xImpl->mpOutliner) { //init draw model first - pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT ); - pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); + m_xImpl->mpOutliner = new Outliner(m_xImpl->mpDoc, OUTLINERMODE_TEXTOBJECT); + m_xImpl->mpDoc->SetCalcFieldValueHdl(m_xImpl->mpOutliner); } - pImpl->mpOutliner->SetText( rText ); + m_xImpl->mpOutliner->SetText( rText ); } } OutlinerParaObject* TextAPIEditSource::CreateText() { - if ( pImpl->mpDoc && pImpl->mpOutliner ) - return pImpl->mpOutliner->CreateParaObject(); + if (m_xImpl->mpDoc && m_xImpl->mpOutliner) + return m_xImpl->mpOutliner->CreateParaObject(); else return nullptr; } OUString TextAPIEditSource::GetText() { - if ( pImpl->mpDoc && pImpl->mpOutliner ) - return pImpl->mpOutliner->GetEditEngine().GetText(); + if (m_xImpl->mpDoc && m_xImpl->mpOutliner) + return m_xImpl->mpOutliner->GetEditEngine().GetText(); else return OUString(); } commit 2210f239fffd1e90c199b25d779b60aa797fa53f Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jan 17 20:36:29 2016 +0000 cppcheck: useInitializationList Change-Id: If87c349a5036c54a83839cd66eb60ef6a09a4a46 diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index e6abb85..4a53b28 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -88,14 +88,13 @@ OOXMLFastContextHandler::OOXMLFastContextHandler(OOXMLFastContextHandler * pCont mnDefine(0), mnToken(oox::XML_TOKEN_COUNT), mpStream(pContext->mpStream), + mpParserState(pContext->mpParserState), mnTableDepth(pContext->mnTableDepth), inPositionV(pContext->inPositionV), m_xContext(pContext->m_xContext), m_bDiscardChildren(pContext->m_bDiscardChildren), m_bTookChoice(pContext->m_bTookChoice) { - mpParserState = pContext->mpParserState; - if (mpParserState.get() == nullptr) mpParserState.reset(new OOXMLParserState()); commit a9fb9929a1337f0e858c9d874a63f9578576acec Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 16 21:14:19 2016 +0000 drop now unused basebmp xor mode Change-Id: If4d1a933f5ebf2154c377ef9a8596eb0962d43d3 diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 010548a..4ec0f28 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -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 ); } } } diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 2751bbf..52ff735 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -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)); } diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx index daa9263..a0a22be 100644 --- a/basebmp/test/bmpmasktest.cxx +++ b/basebmp/test/bmpmasktest.cxx @@ -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) ); diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 78783d4..c2f078b 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -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() diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index fba0957..eaa643f 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -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() diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx index cee7de5..5807c35 100644 --- a/basebmp/test/filltest.cxx +++ b/basebmp/test/filltest.cxx @@ -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); } diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index aa49d91..f462fa3 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -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); } diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 433a08f..ff288dc 100644 --- a/basebmp/test/masktest.cxx +++ b/basebmp/test/masktest.cxx @@ -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() diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx index e026861..db32f93 100644 --- a/basebmp/test/polytest.cxx +++ b/basebmp/test/polytest.cxx @@ -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); } diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx index e68ea73..d0a90ec 100644 --- a/include/basebmp/bitmapdevice.hxx +++ b/include/basebmp/bitmapdevice.hxx @@ -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; diff --git a/include/basebmp/drawmodes.hxx b/include/basebmp/drawmodes.hxx deleted file mode 100644 index 0d7ce92..0000000 --- a/include/basebmp/drawmodes.hxx +++ /dev/null @@ -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: */ diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx index a3ff4d7..3b93e59 100644 --- a/vcl/headless/svpbmp.cxx +++ b/vcl/headless/svpbmp.cxx @@ -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(); diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 43b3853..6c9171b 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -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 commit 08611cf8bfa18aa7605b268c0503bc5bffcc1a12 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 16 20:58:06 2016 +0000 don't need basebmp ClipDevice or DamageTracking now Change-Id: I8a8594084eb5f4c8521cc4b73a94da6259069516 diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 201d870..010548a 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -289,7 +289,6 @@ namespace dest_iterator_type maBegin; typename accessor_traits::color_lookup maColorLookup; - IBitmapDeviceDamageTrackerSharedPtr mpDamage; to_uint32_functor maToUInt32Converter; dest_accessor_type maAccessor; colorblend_accessor_type maColorBlendAccessor; @@ -317,13 +316,11 @@ namespace raw_accessor_type rawAccessor, dest_accessor_type accessor, const RawMemorySharedArray& rMem, - const PaletteMemorySharedVector& rPalette, - const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) : + const PaletteMemorySharedVector& rPalette ) : BitmapDevice( rBounds, rBufferSize, nScanlineFormat, nScanlineStride, pFirstScanline, rMem, rPalette ), maBegin( begin ), maColorLookup(), - mpDamage(rDamage), maToUInt32Converter(), maAccessor( accessor ), maColorBlendAccessor( accessor ), @@ -342,38 +339,6 @@ namespace private: - void damaged( const basegfx::B2IBox& rDamageRect ) const - { - if( mpDamage ) - mpDamage->damaged( rDamageRect ); - } - - void damagedPointSize( const basegfx::B2IPoint& rPoint, - const basegfx::B2IBox& rSize ) const - { - if( mpDamage ) { - basegfx::B2IPoint aLower( rPoint.getX() + rSize.getWidth(), - rPoint.getY() + rSize.getHeight() ); - damaged( basegfx::B2IBox( rPoint, aLower ) ); - } - } - - void damagedPixel( const basegfx::B2IPoint& rDamagePoint ) const - { - if (!mpDamage) - return; - - sal_Int32 nX(rDamagePoint.getX()); - sal_Int32 nY(rDamagePoint.getY()); - if (nX < SAL_MAX_INT32) - ++nX; - if (nY < SAL_MAX_INT32) - ++nY; - - basegfx::B2IPoint aEnd( nX, nY ); - damaged( basegfx::B2IBox( rDamagePoint, aEnd ) ); - } - static std::shared_ptr<BitmapRenderer> getCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) { return std::dynamic_pointer_cast< BitmapRenderer >( bmp ); @@ -420,7 +385,6 @@ namespace maColorLookup( maAccessor, fillColor) ); - damaged( rBounds ); } virtual void setPixel_i( const basegfx::B2IPoint& rPt, @@ -436,7 +400,6 @@ namespace else maAccessor.set( pixelColor, pixel ); - damagedPixel(rPt); } virtual void setPixel_i( const basegfx::B2IPoint& rPt, @@ -460,7 +423,6 @@ namespace else maMaskedAccessor.set( pixelColor, aIter ); - damagedPixel(rPt); } virtual Color getPixel_i(const basegfx::B2IPoint& rPt ) override @@ -493,25 +455,6 @@ namespace col, begin, rawAcc ); - - if (!mpDamage) - return; - - // TODO(P2): perhaps this needs pushing up the stack a bit - // to make more complex polygons more efficient ... - basegfx::B2IBox aBounds(rPt1, rPt2 ); - - const basegfx::B2IPoint& rEnd = aBounds.getMaximum(); - - sal_Int32 nX(rEnd.getX()); - sal_Int32 nY(rEnd.getY()); - if (nX < SAL_MAX_INT32) - ++nX; - if (nY < SAL_MAX_INT32) - ++nY; - - basegfx::B2IBox aDamagedBox(aBounds.getMinimum(), basegfx::B2IPoint(nX, nY)); - damaged(aDamagedBox); } template< typename Iterator, typename Accessor, typename RawAcc > @@ -662,12 +605,6 @@ namespace rBounds, aPoly, basegfx::FillRule::EvenOdd ); - - if( mpDamage ) - { - basegfx::B2DRange const aPolyBounds( basegfx::tools::getRange(aPoly) ); - damaged( basegfx::unotools::b2ISurroundingBoxFromB2DRange( aPolyBounds ) ); - } } virtual void fillPolyPolygon_i(const basegfx::B2DPolyPolygon& rPoly, @@ -723,7 +660,6 @@ namespace acc, rDstRect), isSharedBuffer(rSrcBitmap) ); - damaged( rDstRect ); } template< typename Iterator, typename Acc > @@ -742,7 +678,6 @@ namespace destIterRange(begin, acc, rDstRect)); - damaged( rDstRect ); } void implDrawBitmapDirect(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -827,7 +762,6 @@ namespace maBegin, maAccessor); } - damaged( rDstRect ); } virtual void drawBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -858,7 +792,6 @@ namespace getMaskedIter(rClip), maMaskedAccessor); } - damaged( rDstRect ); } virtual void drawMaskedColor_i(Color aSrcColor, @@ -907,7 +840,6 @@ namespace maGenericColorBlendAccessor, rDstPoint) ); } - damagedPointSize( rDstPoint, rSrcRect ); } virtual void drawMaskedColor_i(Color aSrcColor, @@ -970,7 +902,6 @@ namespace maGenericMaskedColorBlendAccessor, rDstPoint) ); } - damagedPointSize( rDstPoint, rSrcRect ); } template< typename Iterator, typename Acc > @@ -1001,7 +932,6 @@ namespace FastMask >::type(acc), rDstRect), isSharedBuffer(rSrcBitmap)); - damaged( rDstRect ); } template< typename Iterator, typename Acc > @@ -1035,7 +965,6 @@ namespace Masks::clipmask_polarity, NoFastMask >::type(acc), rDstRect)); - damaged( rDstRect ); } virtual void drawMaskedBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -1071,7 +1000,6 @@ namespace maBegin, maAccessor); } - damaged( rDstRect ); } virtual void drawMaskedBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -1108,16 +1036,6 @@ namespace getMaskedIter(rClip), maMaskedAccessor); } - damaged( rDstRect ); - } - - IBitmapDeviceDamageTrackerSharedPtr getDamageTracker_i() const override - { - return mpDamage; - } - void setDamageTracker_i( const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) override - { - mpDamage = rDamage; } }; } // namespace @@ -1229,16 +1147,6 @@ RawMemorySharedArray BitmapDevice::getBuffer() const return mpImpl->mpMem; } -IBitmapDeviceDamageTrackerSharedPtr BitmapDevice::getDamageTracker() const -{ - return getDamageTracker_i(); -} - ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits