[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 838 commits - accessibility/inc accessibility/source avmedia/source basctl/inc basctl/sdi basctl/source basegfx/source basic/inc basic/qa basic/source bin/check-implementer-notes.py bin/find-can-be-private-symbols.classes.results bin/find-headers-to-move-inside-modules.py bin/find-mergedlib-can-be-private.classes.results bin/find-unused-defines.py bin/find-unused-typedefs.py bin/gen-boost-headers bin/update_pch bridges/Library_cpp_uno.mk bridges/source canvas/source chart2/CppunitTest_chart2_geometry.mk chart2/inc chart2/Module_chart2.mk chart2/qa chart2/source chart2/uiconfig comphelper/inc comphelper/Library_comphelper.mk comphelper/source compilerplugins/clang config.guess config_host/config_buildid.h.in config_host.mk.in configmgr/source config.sub configure.ac connectivity/inc connectivity/Library_ado.mk connectivity/Library_odbc.mk connectivity/Library_sdbc2.mk connectivity/source cppcanvas/inc cppuhelper/inc cppuhelper/sou rce cppu/source cui/inc cui/source cui/uiconfig dbaccess/inc dbaccess/Library_dba.mk dbaccess/Library_dbu.mk dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk dbaccess/util desktop/inc desktop/qa desktop/source dictionaries download.lst drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source dtrans/Library_dnd.mk dtrans/Library_dtrans.mk dtrans/Library_ftransl.mk dtrans/Library_sysdtrans.mk dtrans/source dtrans/util editeng/source embeddedobj/Library_embobj.mk embeddedobj/Library_emboleobj.mk embeddedobj/source embeddedobj/util embedserv/source emfio/CppunitTest_emfio_emf_test.mk emfio/inc emfio/Library_emfio.mk emfio/source extensions/CustomTarget_so_activex_x64.mk extensions/Library_dbp.mk extensions/Library_ldapbe2.mk extensions/Library_pcr.mk extensions/Library_scn.mk extensions/Library_WinUserInfoBe.mk extension s/source external/boost external/cppunit external/gpgmepp external/libgpg-error external/liborcus external/libpng external/libtommath external/libwps external/mariadb-connector-c external/nss external/openssl external/pdfium external/python3 external/skia extras/source filter/Library_filterconfig.mk filter/Library_pdffilter.mk filter/Library_svgfilter.mk filter/source forms/source fpicker/Library_fps.mk fpicker/source framework/inc framework/qa framework/source .git-hooks/pre-commit helpcontent2 i18npool/inc i18npool/source i18npool/util i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_dark_svg icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_dark_svg icon-themes/sifr_svg icon-themes/sukapura icon-themes/sukapura_svg idlc/source include/basegfx include/comphelper include/dbaccess i nclude/drawinglayer include/editeng include/filter include/IwyuFilter_include.yaml include/LibreOfficeKit include/o3tl include/oox include/rtl include/sal include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/ucbhelper include/unotest include/unotools include/vbahelper include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk ios/UnitTest javaunohelper/pom.juh.xml jurt/pom.jurt.xml libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/source logerrit lotuswordpro/inc lotuswordpro/source nlpsolver/src o3tl/qa odk/examples offapi/com officecfg/registry oox/inc oox/Library_oox.mk oox/qa oox/source package/inc package/Library_xstor.mk package/source postprocess/qa qadevOOo/tests readlicense_oo/license reportdesign/inc reportdesign/Library_rpt.mk reportdesign/Library_rptui.mk reportdesign/Library_rptxml.mk reportdesign/source reportdesign/util RepositoryExternal.mk Repository.mk ridljar/pom.ridl.xml sal/osl sal/ qa sal/rtl sax/qa sax/source scaddins/source sccomp/source sc/CppunitTest_sc_ucalc.mk schema/libreoffice sc/inc sc/IwyuFilter_sc.yaml sc/Library_sc.mk sc/Library_vbaobj.mk scp2/source sc/qa sc/sdi sc/source sc/uiconfig sc/util sd/CppunitTest_sd_uimpress.mk sdext/inc sdext/source sd/inc sd/Library_sd.mk sd/qa sd/sdi sd/source sd/uiconfig sd/util setup_native/source sfx2/inc sfx2/Library_sfx.mk sfx2/sdi sfx2/source sfx2/uiconfig shell/Library_smplmail.mk shell/Library_syssh.mk shell/Library_wininetbe.mk shell/source slideshow/CppunitTest_slideshow.mk slideshow/inc slideshow/Library_slideshow.mk slideshow/source solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/sanitizers sot/source starmath/inc starmath/Library_sm.mk starmath/source starmath/util stoc/source svgio/CppunitTest_svgio.mk svgio/inc svgio/Library_svgio.mk svgio/source svl/inc svl/source svtools/inc svtools/Library_svt.mk svtools/qa svtools/source svt ools/uiconfig svx/CppunitTest_svx_unit.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/CppunitTest_sw_core_accessibilitycheck.mk sw/CppunitTest_sw_core_crsr.mk sw/CppunitTest_sw_core_doc.mk sw/CppunitTest_sw_core_frmedt.mk sw/CppunitTest_sw_core_layout.mk sw/CppunitTest_sw_core_objectpositioning.mk sw/CppunitTest_sw_core_text.mk sw/CppunitTest_sw_core_txtnode.mk sw/CppunitTest_sw_core_unocore.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_fodfexport.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_rtfexport2.mk sw/CppunitTest_sw_rtfexport3.mk sw/CppunitTest_sw_rtfexport4.mk sw/CppunitTest_sw_rtfexport5.mk sw/Cppunit Test_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_txtexport.mk sw/CppunitTest_sw_uibase_dochdl.mk sw/CppunitTest_sw_uibase_frmdlg.mk sw/CppunitTest_sw_uibase_shells.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export3.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CppunitTest_sw_xhtmlexport.mk sw/inc sw/IwyuFilter_sw.yaml sw/Library_msword.mk sw/Library_sw.mk sw/Library_swqahelper.mk sw/Library_swui.mk sw/Library_vbaswobj.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/qa sw/sdi sw/source sw/uiconfig sw/util test/source toolkit/source tools/qa tools/source translations ucbhelper/source ucb/Library_srtrs1.mk ucb/Library_ucb1.mk ucb/Library_ucpdav1.mk ucb/Library_ucpext.mk ucb/Library_ucpftp1.mk ucb/Library_ucppkg1.mk ucb/source uitest/writer_tests8 UnoControls/source unodevtools/source unoidl/source unoil/pom.u noil.xml unotest/source unotools/inc unotools/Library_utl.mk unotools/source unoxml/source uui/inc uui/source vbahelper/inc vbahelper/source vcl/backendtest vcl/headless vcl/inc vcl/jsdialog vcl/Library_vcl.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/README.vars vcl/skia vcl/source vcl/uiconfig vcl/unx vcl/win vcl/workben winaccessibility/source wizards/com writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/inc writerfilter/Module_writerfilter.mk writerfilter/qa writerfilter/source writerperfect/source xmlhelp/source xmloff/CppunitTest_xmloff_draw.mk xmloff/CppunitTest_xmloff_text.mk xmloff/inc xmloff/IwyuFilter_xmloff.yaml xmloff/Module_xmloff.mk xmloff/qa xmloff/source xmloff/util xmlscript/source xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/workben
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 13 06:57:08 UTC 2020
Rebased ref, commits from common ancestor:
commit 026dbac8d7ff24d3b6c396a48f1c05536392dffc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Aug 13 08:49:30 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 13 08:55:53 2020 +0200
remove constructor with plain Bitmap from Graphic, use BitmapEx
Change-Id: Ie429a10a8f54c6779d437ee4bc75a5ea0c427848
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 89ba081348c2..cc60076b58a6 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4309,7 +4309,8 @@ void SbRtl_LoadPicture(StarBASIC *, SbxArray & rPar, bool)
{
Bitmap aBmp;
ReadDIB(aBmp, *pStream, true);
- Graphic aGraphic(aBmp);
+ BitmapEx aBitmapEx(aBmp);
+ Graphic aGraphic(aBitmapEx);
SbxObjectRef xRef = new SbStdPicture;
static_cast<SbStdPicture*>(xRef.get())->SetGraphic( aGraphic );
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 535c49184dae..a903bf99aa99 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1310,7 +1310,7 @@ namespace emfio
Color(),
Color(),
0,
- Graphic (maLatestFillStyle.aBmp) );
+ Graphic (BitmapEx(maLatestFillStyle.aBmp)));
SvMemoryStream aMemStm;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 57f034e38870..ea37cbe45b47 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6555,7 +6555,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
Bitmap aNew;
if( ReadDIB(aNew, *pGrStream, false) )
{
- rData = Graphic( aNew );
+ rData = Graphic(BitmapEx(aNew));
nRes = ERRCODE_NONE;
}
}
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index f6a47e43b8ec..1880041b4ba5 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_VCL_GRAPH_HXX
-#define INCLUDED_VCL_GRAPH_HXX
+#pragma once
#include <memory>
#include <vcl/dllapi.h>
@@ -93,7 +92,6 @@ public:
Graphic( const GraphicExternalLink& rGraphicLink );
Graphic( const Graphic& rGraphic );
Graphic( Graphic&& rGraphic ) noexcept;
- Graphic( const Bitmap& rBmp );
Graphic( const Image& rImage );
Graphic( const BitmapEx& rBmpEx );
Graphic( const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr );
@@ -213,6 +211,4 @@ struct hash<Graphic>
} // end namespace std
-#endif // INCLUDED_VCL_GRAPH_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 70f30c693bb3..70252f6e6699 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -752,7 +752,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
aBitmap = aXOBitmap.GetBitmap().GetBitmap();
rSdrObj.SetMergedItem(XFillStyleItem(drawing::FillStyle_BITMAP));
- rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_OUSTRING, Graphic(aBitmap)));
+ rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_OUSTRING, Graphic(BitmapEx(aBitmap))));
}
}
}
@@ -4137,7 +4137,7 @@ void XclImpDrawing::ReadBmp( Graphic& rGraphic, const XclImpRoot& rRoot, XclImpS
aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
Bitmap aBitmap;
if( ReadDIB(aBitmap, aMemStrm, false) ) // read DIB without file header
- rGraphic = aBitmap;
+ rGraphic = BitmapEx(aBitmap);
}
void XclImpDrawing::ReadDffRecord( XclImpStream& rStrm )
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 59687f189450..2f028a15644e 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -167,7 +167,7 @@ void SdDrawDocument::CreateLayoutTemplates()
Size aNullSize( 32, 32 );
Bitmap aNullBmp( aNullSize, 8 );
aNullBmp.Erase( COL_WHITE );
- rISet.Put(XFillBitmapItem(Graphic(aNullBmp)));
+ rISet.Put(XFillBitmapItem(Graphic(BitmapEx(aNullBmp))));
// Shadow attributes (Drawing Engine)
rISet.Put(makeSdrShadowItem(false));
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index 843d593f5e28..dce0e837ac38 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -103,7 +103,7 @@ void SdVectorizeDlg::InitPreviewBmp()
aPreviewBmp = aBmp;
aPreviewBmp.Scale( aRect.GetSize() );
- m_aBmpWin.SetGraphic( aPreviewBmp );
+ m_aBmpWin.SetGraphic(BitmapEx(aPreviewBmp));
}
Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale )
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c4ae7621a60c..1ecd4aa48efe 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -194,21 +194,21 @@ bool View::InsertMetaFile( TransferableDataHelper& rDataHelper, const Point& rPo
{
MetaBmpAction* pBmpAction = dynamic_cast< MetaBmpAction* >( pAction );
if( pBmpAction )
- aGraphic = Graphic( pBmpAction->GetBitmap() );
+ aGraphic = Graphic(BitmapEx(pBmpAction->GetBitmap()));
}
break;
case MetaActionType::BMPSCALE:
{
MetaBmpScaleAction* pBmpScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
if( pBmpScaleAction )
- aGraphic = Graphic( pBmpScaleAction->GetBitmap() );
+ aGraphic = Graphic(BitmapEx(pBmpScaleAction->GetBitmap()));
}
break;
case MetaActionType::BMPEX:
{
MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
if( pBmpExAction )
- aGraphic = Graphic( pBmpExAction->GetBitmapEx() );
+ aGraphic = Graphic(pBmpExAction->GetBitmapEx() );
}
break;
case MetaActionType::BMPEXSCALE:
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 8245f6da66ec..7f760ab26e13 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -559,7 +559,7 @@ bool LinkManager::GetGraphicFromAny(const OUString& rMimeType,
{
Bitmap aBmp;
ReadDIB(aBmp, aMemStm, true);
- rGraphic = aBmp;
+ rGraphic = BitmapEx(aBmp);
bRet = true;
}
break;
diff --git a/svtools/qa/unit/GraphicObjectTest.cxx b/svtools/qa/unit/GraphicObjectTest.cxx
index bb09612f7d72..849dea550606 100644
--- a/svtools/qa/unit/GraphicObjectTest.cxx
+++ b/svtools/qa/unit/GraphicObjectTest.cxx
@@ -45,7 +45,7 @@ private:
void GraphicObjectTest::testTdf88836()
{
// Construction with empty bitmap -> type should be GraphicType::NONE
- Graphic aGraphic = Bitmap();
+ Graphic aGraphic = BitmapEx(Bitmap());
CPPUNIT_ASSERT_EQUAL(int(GraphicType::NONE), int(aGraphic.GetType()));
aGraphic = Graphic(BitmapEx());
CPPUNIT_ASSERT_EQUAL(int(GraphicType::NONE), int(aGraphic.GetType()));
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 52cd4f2ae79b..ca3b0d21ef6c 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -811,7 +811,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMP:
{
MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
- const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
+ const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
aMtf.AddAction( pAct );
@@ -821,7 +821,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMPSCALE:
{
MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
- const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
+ const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp );
aMtf.AddAction( pAct );
@@ -831,7 +831,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
case MetaActionType::BMPSCALEPART:
{
MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
- const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmapEx().GetBitmap() );
+ const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp );
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 1f62442af896..1555951984c1 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -1092,7 +1092,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction const & rAct)
aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
SdrGrafObj* pGraf = new SdrGrafObj(
*mpModel,
- Graphic(rAct.GetBitmap()),
+ Graphic(BitmapEx(rAct.GetBitmap())),
aRect);
// This action is not creating line and fill, set directly, do not use SetAttributes(..)
@@ -1107,7 +1107,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction const & rAct)
aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
SdrGrafObj* pGraf = new SdrGrafObj(
*mpModel,
- Graphic(rAct.GetBitmap()),
+ Graphic(BitmapEx(rAct.GetBitmap())),
aRect);
// This action is not creating line and fill, set directly, do not use SetAttributes(..)
@@ -1319,14 +1319,14 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaTextRectAction const & rAct)
void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction const & rAct)
{
tools::Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
- Bitmap aBitmap(rAct.GetBitmap());
+ BitmapEx aBitmapEx(rAct.GetBitmap());
aRect.AdjustRight( 1 );
aRect.AdjustBottom( 1 );
- aBitmap.Crop(tools::Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
+ aBitmapEx.Crop(tools::Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
SdrGrafObj* pGraf = new SdrGrafObj(
*mpModel,
- aBitmap,
+ aBitmapEx,
aRect);
// This action is not creating line and fill, set directly, do not use SetAttributes(..)
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 15123e853484..8680b6fe8189 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -284,7 +284,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
if( pVDev->SetOutputSizePixel( aSize ) )
{
rGraphic.Draw( pVDev.get(), Point(), aSize );
- aGraphic = pVDev->GetBitmap( Point(), aSize );
+ aGraphic = BitmapEx(pVDev->GetBitmap(Point(), aSize));
}
else
aGraphic = rGraphic.GetBitmapEx();
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index 8b21f1c46105..73a6676e4d7b 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -58,7 +58,6 @@ public:
std::shared_ptr<ImpGraphic> copy(std::shared_ptr<ImpGraphic> const& pImpGraphic);
std::shared_ptr<ImpGraphic> newInstance();
- std::shared_ptr<ImpGraphic> newInstance(const Bitmap& rBitmap);
std::shared_ptr<ImpGraphic> newInstance(const BitmapEx& rBitmapEx);
std::shared_ptr<ImpGraphic>
newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr);
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 749a5b82a12e..8b3cc14b7f2d 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_VCL_INC_IMPGRAPH_HXX
-#define INCLUDED_VCL_INC_IMPGRAPH_HXX
+#pragma once
#include <vcl/dllapi.h>
#include <vcl/GraphicExternalLink.hxx>
@@ -83,7 +82,6 @@ public:
ImpGraphic( const ImpGraphic& rImpGraphic );
ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept;
ImpGraphic( const GraphicExternalLink& rExternalLink);
- ImpGraphic( const Bitmap& rBmp );
ImpGraphic( const BitmapEx& rBmpEx );
ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr);
ImpGraphic( const Animation& rAnimation );
@@ -209,6 +207,4 @@ public:
OUString getSwapFileURL();
};
-#endif // INCLUDED_VCL_INC_IMPGRAPH_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 68ddebb4380b..7a9cf89fceaf 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -41,7 +41,7 @@ class BackendTest : public test::BootstrapFixture
Bitmap aBitmap(rBitmap);
aBitmap.Scale(Size(128, 128), BmpScaleFlag::Fast);
SvFileStream aStream(rsFilename, StreamMode::WRITE | StreamMode::TRUNC);
- GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmap, aStream);
+ GraphicFilter::GetGraphicFilter().compressAsPNG(BitmapEx(aBitmap), aStream);
}
}
diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx
index a519da24ed9b..12b32bc316f7 100644
--- a/vcl/qa/cppunit/BitmapFilterTest.cxx
+++ b/vcl/qa/cppunit/BitmapFilterTest.cxx
@@ -69,7 +69,7 @@ private:
{
SvFileStream aStream(sWhere, StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(rBmp, aStream);
+ rFilter.compressAsPNG(BitmapEx(rBmp), aStream);
}
};
@@ -201,7 +201,7 @@ void BitmapFilterTest::testPerformance()
std::unique_ptr<SvFileStream> pStream(
new SvFileStream("~/BlurBigPerformance.png", StreamMode::WRITE | StreamMode::TRUNC));
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aResult, *pStream);
+ rFilter.compressAsPNG(BitmapEx(aResult), *pStream);
pStream.reset(new SvFileStream("~/BlurBigPerformance.txt", StreamMode::WRITE));
pStream->WriteOString("Blur average time: ");
diff --git a/vcl/qa/cppunit/BitmapScaleTest.cxx b/vcl/qa/cppunit/BitmapScaleTest.cxx
index f73d54f6174d..277e42adbe1b 100644
--- a/vcl/qa/cppunit/BitmapScaleTest.cxx
+++ b/vcl/qa/cppunit/BitmapScaleTest.cxx
@@ -146,14 +146,14 @@ void BitmapScaleTest::testScale()
{
SvFileStream aStream("~/scale_before.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(bitmap, aStream);
+ rFilter.compressAsPNG(BitmapEx(bitmap), aStream);
}
CPPUNIT_ASSERT(bitmap.Scale(scaleSize.destSize, scaleMethod));
if (bExportBitmap)
{
SvFileStream aStream("~/scale_after.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(bitmap, aStream);
+ rFilter.compressAsPNG(BitmapEx(bitmap), aStream);
}
CPPUNIT_ASSERT_EQUAL(scaleSize.destSize, bitmap.GetSizePixel());
const int lastW = scaleSize.destSize.getWidth() - 1;
@@ -215,7 +215,7 @@ void BitmapScaleTest::testScale2()
{
SvFileStream aStream("scale_before.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aBitmap24Bit, aStream);
+ rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream);
}
// Scale - 65x65
@@ -228,7 +228,7 @@ void BitmapScaleTest::testScale2()
{
SvFileStream aStream("scale_after_65x65.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aScaledBitmap, aStream);
+ rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream);
}
CPPUNIT_ASSERT_EQUAL(static_cast<long>(65), aScaledBitmap.GetSizePixel().Width());
@@ -245,7 +245,7 @@ void BitmapScaleTest::testScale2()
{
SvFileStream aStream("scale_after_64x64.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aScaledBitmap, aStream);
+ rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream);
}
CPPUNIT_ASSERT_EQUAL(static_cast<long>(64), aScaledBitmap.GetSizePixel().Width());
@@ -262,7 +262,7 @@ void BitmapScaleTest::testScale2()
{
SvFileStream aStream("scale_after_63x63.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aScaledBitmap, aStream);
+ rFilter.compressAsPNG(BitmapEx(aScaledBitmap), aStream);
}
CPPUNIT_ASSERT_EQUAL(static_cast<long>(63), aScaledBitmap.GetSizePixel().Width());
@@ -297,7 +297,7 @@ void BitmapScaleTest::testScaleSymmetry()
{
SvFileStream aStream("~/scale_before.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aBitmap24Bit, aStream);
+ rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream);
}
aBitmap24Bit.Scale(2, 2, BmpScaleFlag::Fast);
@@ -313,7 +313,7 @@ void BitmapScaleTest::testScaleSymmetry()
{
SvFileStream aStream("~/scale_after.png", StreamMode::WRITE | StreamMode::TRUNC);
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- rFilter.compressAsPNG(aBitmap24Bit, aStream);
+ rFilter.compressAsPNG(BitmapEx(aBitmap24Bit), aStream);
}
}
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index 26f743cfa311..bc745fc530f8 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -116,7 +116,7 @@ void VclFiltersTest::checkExportImport(const OUString& aFilterShortName)
aFilterData[ 2 ].Value <<= sal_Int32(90);
sal_uInt16 aFilterType = mpGraphicFilter->GetExportFormatNumberForShortName(aFilterShortName);
- mpGraphicFilter->ExportGraphic( aBitmap, OUString(), aStream, aFilterType, &aFilterData );
+ mpGraphicFilter->ExportGraphic(BitmapEx(aBitmap), OUString(), aStream, aFilterType, &aFilterData );
CPPUNIT_ASSERT(aStream.Tell() > 0);
diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx
index 045a6de0571e..f2ad9bd1132c 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -712,7 +712,7 @@ Graphic GIFReader::GetIntermediateGraphic()
bStatus = bStatus && pAcc1;
}
else
- aImGraphic = aBmp8;
+ aImGraphic = BitmapEx(aBmp8);
pAcc8 = BitmapScopedWriteAccess(aBmp8);
bStatus = bStatus && pAcc8;
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index fa71bfa3cb75..1e47bfe9d765 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -254,7 +254,7 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
}
else
{
- rGraphic = maBmp;
+ rGraphic = BitmapEx(maBmp);
}
eReadState = XPMREAD_OK;
}
diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx
index cd378f4a855f..0ea4ef493886 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -269,12 +269,12 @@ Graphic JPEGReader::CreateIntermediateGraphic(long nLines)
}
else
{
- aGraphic = *mpBitmap;
+ aGraphic = BitmapEx(*mpBitmap);
}
}
else
{
- aGraphic = *mpBitmap;
+ aGraphic = BitmapEx(*mpBitmap);
}
mnLastLines = nLines;
@@ -304,7 +304,7 @@ ReadState JPEGReader::Read( Graphic& rGraphic, GraphicFilterImportFlags nImportF
else
{
if (!bUseExistingBitmap)
- rGraphic = *mpBitmap;
+ rGraphic = BitmapEx(*mpBitmap);
}
bRet = true;
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 05ad9657d8d9..b88aaf0e9f3f 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -182,11 +182,6 @@ Graphic::Graphic(GraphicExternalLink const & rGraphicExternalLink)
{
}
-Graphic::Graphic(const Bitmap& rBmp)
- : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rBmp))
-{
-}
-
Graphic::Graphic(const BitmapEx& rBmpEx)
: mxImpGraphic(vcl::graphic::Manager::get().newInstance(rBmpEx))
{
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 925ec4a34952..c40a344ba1da 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -186,17 +186,6 @@ ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) :
{
}
-ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
- maBitmapEx ( rBitmap ),
- meType ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
- mnSizeBytes ( 0 ),
- mbSwapOut ( false ),
- mbDummyContext ( false ),
- maLastUsed (std::chrono::high_resolution_clock::now()),
- mbPrepared (false)
-{
-}
-
ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
maBitmapEx ( rBitmapEx ),
meType ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index c8e5847aaa4d..177a8772c304 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -204,7 +204,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
else
aMask = aBitmapEx.GetMask();
}
- Graphic aGraphic( aBitmapEx.GetBitmap() );
+ Graphic aGraphic(BitmapEx(aBitmapEx.GetBitmap()));
Sequence< PropertyValue > aFilterData( 2 );
aFilterData[ 0 ].Name = "Quality";
diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx
index dc60db55dd3f..d858b47b8f34 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -308,9 +308,9 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const tools::Rectangle& r
GraphicObject aAlphaGraphic;
if( GetGraphic().IsAlpha() )
- aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() );
+ aAlphaGraphic.SetGraphic(BitmapEx(GetGraphic().GetBitmapEx().GetAlpha().GetBitmap()));
else
- aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() );
+ aAlphaGraphic.SetGraphic(BitmapEx(GetGraphic().GetBitmapEx().GetMask()));
if( aAlphaGraphic.ImplRenderTempTile( *aVDev, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr ) )
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 65e81fc1e605..7a25f8e41b04 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -178,13 +178,6 @@ std::shared_ptr<ImpGraphic> Manager::newInstance()
return pReturn;
}
-std::shared_ptr<ImpGraphic> Manager::newInstance(const Bitmap& rBitmap)
-{
- auto pReturn = std::make_shared<ImpGraphic>(rBitmap);
- registerGraphic(pReturn, "Bitmap");
- return pReturn;
-}
-
std::shared_ptr<ImpGraphic> Manager::newInstance(const BitmapEx& rBitmapEx)
{
auto pReturn = std::make_shared<ImpGraphic>(rBitmapEx);
commit 9b23b1fdc70cc3a4d26f369ec40340611b1d1557
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jul 20 20:13:26 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 13 08:54:44 2020 +0200
remove polygonprimitive2d.cxx from clang-format blacklist
Change-Id: I3122a4058f5447cbf0369b60b368c76e5fe40089
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 6d2784dee46d..e74be52cf98d 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -31,569 +31,574 @@
using namespace com::sun::star;
using namespace std;
-
namespace drawinglayer::primitive2d
{
- PolygonHairlinePrimitive2D::PolygonHairlinePrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const basegfx::BColor& rBColor)
- : BasePrimitive2D(),
- maPolygon(rPolygon),
- maBColor(rBColor)
- {
- }
+PolygonHairlinePrimitive2D::PolygonHairlinePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rBColor)
+ : BasePrimitive2D()
+ , maPolygon(rPolygon)
+ , maBColor(rBColor)
+{
+}
- bool PolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BasePrimitive2D::operator==(rPrimitive))
- {
- const PolygonHairlinePrimitive2D& rCompare = static_cast<const PolygonHairlinePrimitive2D&>(rPrimitive);
+bool PolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+ if (BasePrimitive2D::operator==(rPrimitive))
+ {
+ const PolygonHairlinePrimitive2D& rCompare
+ = static_cast<const PolygonHairlinePrimitive2D&>(rPrimitive);
- return (getB2DPolygon() == rCompare.getB2DPolygon()
- && getBColor() == rCompare.getBColor());
- }
+ return (getB2DPolygon() == rCompare.getB2DPolygon() && getBColor() == rCompare.getBColor());
+ }
- return false;
- }
+ return false;
+}
- basegfx::B2DRange PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
- {
- // this is a hairline, thus the line width is view-dependent. Get range of polygon
- // as base size
- basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
+basegfx::B2DRange
+PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+{
+ // this is a hairline, thus the line width is view-dependent. Get range of polygon
+ // as base size
+ basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
- if(!aRetval.isEmpty())
- {
- // Calculate view-dependent hairline width
- const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
- const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
-
- if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
- {
- aRetval.grow(fDiscreteHalfLineWidth);
- }
- }
+ if (!aRetval.isEmpty())
+ {
+ // Calculate view-dependent hairline width
+ const basegfx::B2DVector aDiscreteSize(
+ rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
+ const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
- // return range
- return aRetval;
+ if (basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
+ {
+ aRetval.grow(fDiscreteHalfLineWidth);
}
+ }
- // provide unique ID
- ImplPrimitive2DIDBlock(PolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D)
+ // return range
+ return aRetval;
+}
+// provide unique ID
+ImplPrimitive2DIDBlock(PolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D)
- void PolygonMarkerPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
- {
- // calculate logic DashLength
- const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
- const double fLogicDashLength(aDashVector.getX());
-
- if(fLogicDashLength > 0.0 && !getRGBColorA().equal(getRGBColorB()))
- {
- // apply dashing; get line and gap snippets
- std::vector< double > aDash;
- basegfx::B2DPolyPolygon aDashedPolyPolyA;
- basegfx::B2DPolyPolygon aDashedPolyPolyB;
+ void PolygonMarkerPrimitive2D::create2DDecomposition(
+ Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+{
+ // calculate logic DashLength
+ const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
+ const double fLogicDashLength(aDashVector.getX());
- aDash.push_back(fLogicDashLength);
- aDash.push_back(fLogicDashLength);
- basegfx::utils::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * fLogicDashLength);
+ if (fLogicDashLength > 0.0 && !getRGBColorA().equal(getRGBColorB()))
+ {
+ // apply dashing; get line and gap snippets
+ std::vector<double> aDash;
+ basegfx::B2DPolyPolygon aDashedPolyPolyA;
+ basegfx::B2DPolyPolygon aDashedPolyPolyB;
+
+ aDash.push_back(fLogicDashLength);
+ aDash.push_back(fLogicDashLength);
+ basegfx::utils::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA,
+ &aDashedPolyPolyB, 2.0 * fLogicDashLength);
+
+ rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA()));
+ rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB()));
+ }
+ else
+ {
+ rContainer.push_back(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA()));
+ }
+}
+
+PolygonMarkerPrimitive2D::PolygonMarkerPrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : BufferedDecompositionPrimitive2D()
+ , maPolygon(rPolygon)
+ , maRGBColorA(rRGBColorA)
+ , maRGBColorB(rRGBColorB)
+ , mfDiscreteDashLength(fDiscreteDashLength)
+ , maLastInverseObjectToViewTransformation()
+{
+}
- rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA()));
- rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB()));
- }
- else
- {
- rContainer.push_back(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA()));
- }
- }
+bool PolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+ if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolygonMarkerPrimitive2D& rCompare
+ = static_cast<const PolygonMarkerPrimitive2D&>(rPrimitive);
- PolygonMarkerPrimitive2D::PolygonMarkerPrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const basegfx::BColor& rRGBColorA,
- const basegfx::BColor& rRGBColorB,
- double fDiscreteDashLength)
- : BufferedDecompositionPrimitive2D(),
- maPolygon(rPolygon),
- maRGBColorA(rRGBColorA),
- maRGBColorB(rRGBColorB),
- mfDiscreteDashLength(fDiscreteDashLength),
- maLastInverseObjectToViewTransformation()
- {
- }
+ return (getB2DPolygon() == rCompare.getB2DPolygon()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
- bool PolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolygonMarkerPrimitive2D& rCompare = static_cast<const PolygonMarkerPrimitive2D&>(rPrimitive);
+ return false;
+}
- return (getB2DPolygon() == rCompare.getB2DPolygon()
- && getRGBColorA() == rCompare.getRGBColorA()
- && getRGBColorB() == rCompare.getRGBColorB()
- && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
- }
+basegfx::B2DRange
+PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+{
+ // this is a hairline, thus the line width is view-dependent. Get range of polygon
+ // as base size
+ basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
- return false;
- }
+ if (!aRetval.isEmpty())
+ {
+ // Calculate view-dependent hairline width
+ const basegfx::B2DVector aDiscreteSize(
+ rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
+ const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
- basegfx::B2DRange PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ if (basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
{
- // this is a hairline, thus the line width is view-dependent. Get range of polygon
- // as base size
- basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
+ aRetval.grow(fDiscreteHalfLineWidth);
+ }
+ }
- if(!aRetval.isEmpty())
- {
- // Calculate view-dependent hairline width
- const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
- const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
-
- if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
- {
- aRetval.grow(fDiscreteHalfLineWidth);
- }
- }
+ // return range
+ return aRetval;
+}
- // return range
- return aRetval;
- }
+void PolygonMarkerPrimitive2D::get2DDecomposition(
+ Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ bool bNeedNewDecomposition(false);
- void PolygonMarkerPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ if (!getBuffered2DDecomposition().empty())
+ {
+ if (rViewInformation.getInverseObjectToViewTransformation()
+ != maLastInverseObjectToViewTransformation)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- bool bNeedNewDecomposition(false);
+ bNeedNewDecomposition = true;
+ }
+ }
- if(!getBuffered2DDecomposition().empty())
- {
- if(rViewInformation.getInverseObjectToViewTransformation() != maLastInverseObjectToViewTransformation)
- {
- bNeedNewDecomposition = true;
- }
- }
+ if (bNeedNewDecomposition)
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast<PolygonMarkerPrimitive2D*>(this)->setBuffered2DDecomposition(
+ Primitive2DContainer());
+ }
- if(bNeedNewDecomposition)
- {
- // conditions of last local decomposition have changed, delete
- const_cast< PolygonMarkerPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
- }
+ if (getBuffered2DDecomposition().empty())
+ {
+ // remember last used InverseObjectToViewTransformation
+ PolygonMarkerPrimitive2D* pThat = const_cast<PolygonMarkerPrimitive2D*>(this);
+ pThat->maLastInverseObjectToViewTransformation
+ = rViewInformation.getInverseObjectToViewTransformation();
+ }
- if(getBuffered2DDecomposition().empty())
- {
- // remember last used InverseObjectToViewTransformation
- PolygonMarkerPrimitive2D* pThat = const_cast< PolygonMarkerPrimitive2D* >(this);
- pThat->maLastInverseObjectToViewTransformation = rViewInformation.getInverseObjectToViewTransformation();
- }
+ // use parent implementation
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+}
- // use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
- }
-
- // provide unique ID
- ImplPrimitive2DIDBlock(PolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D)
+// provide unique ID
+ImplPrimitive2DIDBlock(PolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D)
} // end of namespace
namespace drawinglayer::primitive2d
- {
- void PolygonStrokePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- if(!getB2DPolygon().count())
- return;
-
- // #i102241# try to simplify before usage
- const basegfx::B2DPolygon aB2DPolygon(basegfx::utils::simplifyCurveSegments(getB2DPolygon()));
- basegfx::B2DPolyPolygon aHairLinePolyPolygon;
+{
+void PolygonStrokePrimitive2D::create2DDecomposition(
+ Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ if (!getB2DPolygon().count())
+ return;
- if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen())
- {
- // no line dashing, just copy
- aHairLinePolyPolygon.append(aB2DPolygon);
- }
- else
- {
- // apply LineStyle
- basegfx::utils::applyLineDashing(
- aB2DPolygon, getStrokeAttribute().getDotDashArray(),
- &aHairLinePolyPolygon, nullptr, getStrokeAttribute().getFullDotDashLen());
- }
+ // #i102241# try to simplify before usage
+ const basegfx::B2DPolygon aB2DPolygon(basegfx::utils::simplifyCurveSegments(getB2DPolygon()));
+ basegfx::B2DPolyPolygon aHairLinePolyPolygon;
- const sal_uInt32 nCount(aHairLinePolyPolygon.count());
+ if (getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen())
+ {
+ // no line dashing, just copy
+ aHairLinePolyPolygon.append(aB2DPolygon);
+ }
+ else
+ {
+ // apply LineStyle
+ basegfx::utils::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(),
+ &aHairLinePolyPolygon, nullptr,
+ getStrokeAttribute().getFullDotDashLen());
+ }
- if(!getLineAttribute().isDefault() && getLineAttribute().getWidth())
- {
- // create fat line data
- const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0);
- const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin());
- const css::drawing::LineCap aLineCap(getLineAttribute().getLineCap());
- basegfx::B2DPolyPolygon aAreaPolyPolygon;
- const double fMiterMinimumAngle(getLineAttribute().getMiterMinimumAngle());
-
- for(sal_uInt32 a(0); a < nCount; a++)
- {
- // New version of createAreaGeometry; now creates bezier polygons
- aAreaPolyPolygon.append(basegfx::utils::createAreaGeometry(
- aHairLinePolyPolygon.getB2DPolygon(a),
- fHalfLineWidth,
- aLineJoin,
- aLineCap,
- basegfx::deg2rad(12.5) /* default fMaxAllowedAngle*/ ,
- 0.4 /* default fMaxPartOfEdge*/ ,
- fMiterMinimumAngle));
- }
-
- // create primitive
- for(sal_uInt32 b(0); b < aAreaPolyPolygon.count(); b++)
- {
- // put into single polyPolygon primitives to make clear that this is NOT meant
- // to be painted as a single tools::PolyPolygon (XORed as fill rule). Alternatively, a
- // melting process may be used here one day.
- const basegfx::B2DPolyPolygon aNewPolyPolygon(aAreaPolyPolygon.getB2DPolygon(b));
- const basegfx::BColor aColor(getLineAttribute().getColor());
- rContainer.push_back(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor));
- }
- }
- else
- {
- rContainer.push_back(
- new PolyPolygonHairlinePrimitive2D(
- aHairLinePolyPolygon,
- getLineAttribute().getColor()));
- }
- }
+ const sal_uInt32 nCount(aHairLinePolyPolygon.count());
- PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute)
- : BufferedDecompositionPrimitive2D(),
- maPolygon(rPolygon),
- maLineAttribute(rLineAttribute),
- maStrokeAttribute(rStrokeAttribute)
+ if (!getLineAttribute().isDefault() && getLineAttribute().getWidth())
+ {
+ // create fat line data
+ const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0);
+ const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin());
+ const css::drawing::LineCap aLineCap(getLineAttribute().getLineCap());
+ basegfx::B2DPolyPolygon aAreaPolyPolygon;
+ const double fMiterMinimumAngle(getLineAttribute().getMiterMinimumAngle());
+
+ for (sal_uInt32 a(0); a < nCount; a++)
{
- // MM01: keep these - these are no curve-decompposers but just checks
- // simplify curve segments: moved here to not need to use it
- // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
- maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
+ // New version of createAreaGeometry; now creates bezier polygons
+ aAreaPolyPolygon.append(basegfx::utils::createAreaGeometry(
+ aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, aLineCap,
+ basegfx::deg2rad(12.5) /* default fMaxAllowedAngle*/,
+ 0.4 /* default fMaxPartOfEdge*/, fMiterMinimumAngle));
}
- PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute)
- : BufferedDecompositionPrimitive2D(),
- maPolygon(rPolygon),
- maLineAttribute(rLineAttribute),
- maStrokeAttribute()
+ // create primitive
+ for (sal_uInt32 b(0); b < aAreaPolyPolygon.count(); b++)
{
- // MM01: keep these - these are no curve-decompposers but just checks
- // simplify curve segments: moved here to not need to use it
- // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
- maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
+ // put into single polyPolygon primitives to make clear that this is NOT meant
+ // to be painted as a single tools::PolyPolygon (XORed as fill rule). Alternatively, a
+ // melting process may be used here one day.
+ const basegfx::B2DPolyPolygon aNewPolyPolygon(aAreaPolyPolygon.getB2DPolygon(b));
+ const basegfx::BColor aColor(getLineAttribute().getColor());
+ rContainer.push_back(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor));
}
+ }
+ else
+ {
+ rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon,
+ getLineAttribute().getColor()));
+ }
+}
+
+PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute)
+ : BufferedDecompositionPrimitive2D()
+ , maPolygon(rPolygon)
+ , maLineAttribute(rLineAttribute)
+ , maStrokeAttribute(rStrokeAttribute)
+{
+ // MM01: keep these - these are no curve-decompposers but just checks
+ // simplify curve segments: moved here to not need to use it
+ // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
+ maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
+}
+
+PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute)
+ : BufferedDecompositionPrimitive2D()
+ , maPolygon(rPolygon)
+ , maLineAttribute(rLineAttribute)
+ , maStrokeAttribute()
+{
+ // MM01: keep these - these are no curve-decompposers but just checks
+ // simplify curve segments: moved here to not need to use it
+ // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
+ maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
+}
- bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
- {
- const PolygonStrokePrimitive2D& rCompare = static_cast<const PolygonStrokePrimitive2D&>(rPrimitive);
+bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+ if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const PolygonStrokePrimitive2D& rCompare
+ = static_cast<const PolygonStrokePrimitive2D&>(rPrimitive);
- return (getB2DPolygon() == rCompare.getB2DPolygon()
- && getLineAttribute() == rCompare.getLineAttribute()
- && getStrokeAttribute() == rCompare.getStrokeAttribute());
- }
+ return (getB2DPolygon() == rCompare.getB2DPolygon()
+ && getLineAttribute() == rCompare.getLineAttribute()
+ && getStrokeAttribute() == rCompare.getStrokeAttribute());
+ }
- return false;
- }
+ return false;
+}
- basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
- {
- basegfx::B2DRange aRetval;
+basegfx::B2DRange
+PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+{
+ basegfx::B2DRange aRetval;
- if(getLineAttribute().getWidth())
- {
- bool bUseDecomposition(false);
-
- if(basegfx::B2DLineJoin::Miter == getLineAttribute().getLineJoin())
- {
- // if line is mitered, use parent call since mitered line
- // geometry may use more space than the geometry grown by half line width
- bUseDecomposition = true;
- }
-
- if(!bUseDecomposition && css::drawing::LineCap_SQUARE == getLineAttribute().getLineCap())
- {
- // when drawing::LineCap_SQUARE is used the below method to grow the polygon
- // range by half line width will not work, so use decomposition. Interestingly,
- // the grow method below works perfectly for LineCap_ROUND since the grow is in
- // all directions and the rounded cap needs the same grow in all directions independent
- // from its orientation. Unfortunately this is not the case for drawing::LineCap_SQUARE
- bUseDecomposition = true;
- }
-
- if (bUseDecomposition)
- {
- // get correct range by using the decomposition fallback, reasons see above cases
-
- // ofz#947 to optimize calculating the range, turn any slow dashes into a solid line
- // when just calculating bounds
- attribute::StrokeAttribute aOrigStrokeAttribute = maStrokeAttribute;
- const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute = attribute::StrokeAttribute();
- aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
- const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute = aOrigStrokeAttribute;
- }
- else
- {
- // for all other B2DLINEJOIN_* get the range from the base geometry
- // and expand by half the line width
- aRetval = getB2DPolygon().getB2DRange();
- aRetval.grow(getLineAttribute().getWidth() * 0.5);
- }
- }
- else
- {
- // this is a hairline, thus the line width is view-dependent. Get range of polygon
- // as base size
- aRetval = getB2DPolygon().getB2DRange();
-
- if(!aRetval.isEmpty())
- {
- // Calculate view-dependent hairline width
- const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
- const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
-
- if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
- {
- aRetval.grow(fDiscreteHalfLineWidth);
- }
- }
- }
+ if (getLineAttribute().getWidth())
+ {
+ bool bUseDecomposition(false);
- return aRetval;
+ if (basegfx::B2DLineJoin::Miter == getLineAttribute().getLineJoin())
+ {
+ // if line is mitered, use parent call since mitered line
+ // geometry may use more space than the geometry grown by half line width
+ bUseDecomposition = true;
}
- // provide unique ID
- ImplPrimitive2DIDBlock(PolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D)
-
-
-
- void PolygonWavePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ if (!bUseDecomposition && css::drawing::LineCap_SQUARE == getLineAttribute().getLineCap())
{
- if(!getB2DPolygon().count())
- return;
-
- const bool bHasWidth(!basegfx::fTools::equalZero(getWaveWidth()));
- const bool bHasHeight(!basegfx::fTools::equalZero(getWaveHeight()));
-
- if(bHasWidth && bHasHeight)
- {
- // create waveline curve
- const basegfx::B2DPolygon aWaveline(basegfx::utils::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight()));
- rContainer.push_back(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute()));
- }
- else
- {
- // flat waveline, decompose to simple line primitive
- rContainer.push_back(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute()));
- }
+ // when drawing::LineCap_SQUARE is used the below method to grow the polygon
+ // range by half line width will not work, so use decomposition. Interestingly,
+ // the grow method below works perfectly for LineCap_ROUND since the grow is in
+ // all directions and the rounded cap needs the same grow in all directions independent
+ // from its orientation. Unfortunately this is not the case for drawing::LineCap_SQUARE
+ bUseDecomposition = true;
}
- PolygonWavePrimitive2D::PolygonWavePrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute,
- double fWaveWidth,
- double fWaveHeight)
- : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute),
- mfWaveWidth(fWaveWidth),
- mfWaveHeight(fWaveHeight)
+ if (bUseDecomposition)
{
- if(mfWaveWidth < 0.0)
- {
- mfWaveWidth = 0.0;
- }
-
- if(mfWaveHeight < 0.0)
- {
- mfWaveHeight = 0.0;
- }
+ // get correct range by using the decomposition fallback, reasons see above cases
+
+ // ofz#947 to optimize calculating the range, turn any slow dashes into a solid line
+ // when just calculating bounds
+ attribute::StrokeAttribute aOrigStrokeAttribute = maStrokeAttribute;
+ const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute
+ = attribute::StrokeAttribute();
+ aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
+ const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute = aOrigStrokeAttribute;
}
+ else
+ {
+ // for all other B2DLINEJOIN_* get the range from the base geometry
+ // and expand by half the line width
+ aRetval = getB2DPolygon().getB2DRange();
+ aRetval.grow(getLineAttribute().getWidth() * 0.5);
+ }
+ }
+ else
+ {
+ // this is a hairline, thus the line width is view-dependent. Get range of polygon
+ // as base size
+ aRetval = getB2DPolygon().getB2DRange();
- PolygonWavePrimitive2D::PolygonWavePrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute,
- double fWaveWidth,
- double fWaveHeight)
- : PolygonStrokePrimitive2D(rPolygon, rLineAttribute),
- mfWaveWidth(fWaveWidth),
- mfWaveHeight(fWaveHeight)
+ if (!aRetval.isEmpty())
{
- if(mfWaveWidth < 0.0)
- {
- mfWaveWidth = 0.0;
- }
+ // Calculate view-dependent hairline width
+ const basegfx::B2DVector aDiscreteSize(
+ rViewInformation.getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.0, 0.0));
+ const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
- if(mfWaveHeight < 0.0)
+ if (basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
{
- mfWaveHeight = 0.0;
+ aRetval.grow(fDiscreteHalfLineWidth);
}
}
+ }
- bool PolygonWavePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(PolygonStrokePrimitive2D::operator==(rPrimitive))
- {
- const PolygonWavePrimitive2D& rCompare = static_cast<const PolygonWavePrimitive2D&>(rPrimitive);
+ return aRetval;
+}
- return (getWaveWidth() == rCompare.getWaveWidth()
- && getWaveHeight() == rCompare.getWaveHeight());
- }
+// provide unique ID
+ImplPrimitive2DIDBlock(PolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D)
- return false;
- }
+ void PolygonWavePrimitive2D::create2DDecomposition(
+ Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ if (!getB2DPolygon().count())
+ return;
- basegfx::B2DRange PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
- {
- // get range of parent
- basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation));
+ const bool bHasWidth(!basegfx::fTools::equalZero(getWaveWidth()));
+ const bool bHasHeight(!basegfx::fTools::equalZero(getWaveHeight()));
- // if WaveHeight, grow by it
- if(basegfx::fTools::more(getWaveHeight(), 0.0))
- {
- aRetval.grow(getWaveHeight());
- }
+ if (bHasWidth && bHasHeight)
+ {
+ // create waveline curve
+ const basegfx::B2DPolygon aWaveline(
+ basegfx::utils::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight()));
+ rContainer.push_back(
+ new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute()));
+ }
+ else
+ {
+ // flat waveline, decompose to simple line primitive
+ rContainer.push_back(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(),
+ getStrokeAttribute()));
+ }
+}
+
+PolygonWavePrimitive2D::PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ double fWaveWidth, double fWaveHeight)
+ : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute)
+ , mfWaveWidth(fWaveWidth)
+ , mfWaveHeight(fWaveHeight)
+{
+ if (mfWaveWidth < 0.0)
+ {
+ mfWaveWidth = 0.0;
+ }
- // if line width, grow by it
- if(basegfx::fTools::more(getLineAttribute().getWidth(), 0.0))
- {
- aRetval.grow(getLineAttribute().getWidth() * 0.5);
- }
+ if (mfWaveHeight < 0.0)
+ {
+ mfWaveHeight = 0.0;
+ }
+}
+
+PolygonWavePrimitive2D::PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ double fWaveWidth, double fWaveHeight)
+ : PolygonStrokePrimitive2D(rPolygon, rLineAttribute)
+ , mfWaveWidth(fWaveWidth)
+ , mfWaveHeight(fWaveHeight)
+{
+ if (mfWaveWidth < 0.0)
+ {
+ mfWaveWidth = 0.0;
+ }
- return aRetval;
- }
+ if (mfWaveHeight < 0.0)
+ {
+ mfWaveHeight = 0.0;
+ }
+}
- // provide unique ID
- ImplPrimitive2DIDBlock(PolygonWavePrimitive2D, PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D)
+bool PolygonWavePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+ if (PolygonStrokePrimitive2D::operator==(rPrimitive))
+ {
+ const PolygonWavePrimitive2D& rCompare
+ = static_cast<const PolygonWavePrimitive2D&>(rPrimitive);
+ return (getWaveWidth() == rCompare.getWaveWidth()
+ && getWaveHeight() == rCompare.getWaveHeight());
+ }
- void PolygonStrokeArrowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- // copy local polygon, it may be changed
- basegfx::B2DPolygon aLocalPolygon(getB2DPolygon());
- aLocalPolygon.removeDoublePoints();
- basegfx::B2DPolyPolygon aArrowA;
- basegfx::B2DPolyPolygon aArrowB;
+ return false;
+}
- if(!aLocalPolygon.isClosed() && aLocalPolygon.count() > 1)
- {
- // apply arrows
- const double fPolyLength(basegfx::utils::getLength(aLocalPolygon));
- double fStart(0.0);
- double fEnd(0.0);
- double fStartOverlap(0.0);
- double fEndOverlap(0.0);
-
- if(!getStart().isDefault() && getStart().isActive())
- {
- // create start arrow primitive and consume
- aArrowA = basegfx::utils::createAreaGeometryForLineStartEnd(
- aLocalPolygon, getStart().getB2DPolyPolygon(), true, getStart().getWidth(),
- fPolyLength, getStart().isCentered() ? 0.5 : 0.0, &fStart);
-
- // create some overlapping, compromise between straight and peaked markers
- // for marker width 0.3cm and marker line width 0.02cm
- fStartOverlap = getStart().getWidth() / 15.0;
- }
-
- if(!getEnd().isDefault() && getEnd().isActive())
- {
- // create end arrow primitive and consume
- aArrowB = basegfx::utils::createAreaGeometryForLineStartEnd(
- aLocalPolygon, getEnd().getB2DPolyPolygon(), false, getEnd().getWidth(),
- fPolyLength, getEnd().isCentered() ? 0.5 : 0.0, &fEnd);
-
- // create some overlapping
- fEndOverlap = getEnd().getWidth() / 15.0;
- }
-
- if(0.0 != fStart || 0.0 != fEnd)
- {
- // build new poly, consume something from old poly
- aLocalPolygon = basegfx::utils::getSnippetAbsolute(aLocalPolygon, fStart-fStartOverlap, fPolyLength - fEnd + fEndOverlap, fPolyLength);
- }
- }
+basegfx::B2DRange
+PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+{
+ // get range of parent
+ basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation));
- // add shaft
- rContainer.push_back(new
- PolygonStrokePrimitive2D(
- aLocalPolygon, getLineAttribute(), getStrokeAttribute()));
+ // if WaveHeight, grow by it
+ if (basegfx::fTools::more(getWaveHeight(), 0.0))
+ {
+ aRetval.grow(getWaveHeight());
+ }
- if(aArrowA.count())
- {
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- aArrowA, getLineAttribute().getColor()));
- }
+ // if line width, grow by it
+ if (basegfx::fTools::more(getLineAttribute().getWidth(), 0.0))
+ {
+ aRetval.grow(getLineAttribute().getWidth() * 0.5);
+ }
- if(aArrowB.count())
- {
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- aArrowB, getLineAttribute().getColor()));
- }
- }
+ return aRetval;
+}
- PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute,
- const attribute::LineStartEndAttribute& rStart,
- const attribute::LineStartEndAttribute& rEnd)
- : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute),
- maStart(rStart),
- maEnd(rEnd)
- {
- }
+// provide unique ID
+ImplPrimitive2DIDBlock(PolygonWavePrimitive2D, PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D)
+
+ void PolygonStrokeArrowPrimitive2D::create2DDecomposition(
+ Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ // copy local polygon, it may be changed
+ basegfx::B2DPolygon aLocalPolygon(getB2DPolygon());
+ aLocalPolygon.removeDoublePoints();
+ basegfx::B2DPolyPolygon aArrowA;
+ basegfx::B2DPolyPolygon aArrowB;
- PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
- const basegfx::B2DPolygon& rPolygon,
- const attribute::LineAttribute& rLineAttribute,
- const attribute::LineStartEndAttribute& rStart,
- const attribute::LineStartEndAttribute& rEnd)
- : PolygonStrokePrimitive2D(rPolygon, rLineAttribute),
- maStart(rStart),
- maEnd(rEnd)
+ if (!aLocalPolygon.isClosed() && aLocalPolygon.count() > 1)
+ {
+ // apply arrows
+ const double fPolyLength(basegfx::utils::getLength(aLocalPolygon));
+ double fStart(0.0);
+ double fEnd(0.0);
+ double fStartOverlap(0.0);
+ double fEndOverlap(0.0);
+
+ if (!getStart().isDefault() && getStart().isActive())
{
+ // create start arrow primitive and consume
+ aArrowA = basegfx::utils::createAreaGeometryForLineStartEnd(
+ aLocalPolygon, getStart().getB2DPolyPolygon(), true, getStart().getWidth(),
+ fPolyLength, getStart().isCentered() ? 0.5 : 0.0, &fStart);
+
+ // create some overlapping, compromise between straight and peaked markers
+ // for marker width 0.3cm and marker line width 0.02cm
+ fStartOverlap = getStart().getWidth() / 15.0;
}
- bool PolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ if (!getEnd().isDefault() && getEnd().isActive())
{
- if(PolygonStrokePrimitive2D::operator==(rPrimitive))
- {
- const PolygonStrokeArrowPrimitive2D& rCompare = static_cast<const PolygonStrokeArrowPrimitive2D&>(rPrimitive);
-
- return (getStart() == rCompare.getStart()
- && getEnd() == rCompare.getEnd());
- }
+ // create end arrow primitive and consume
+ aArrowB = basegfx::utils::createAreaGeometryForLineStartEnd(
+ aLocalPolygon, getEnd().getB2DPolyPolygon(), false, getEnd().getWidth(),
+ fPolyLength, getEnd().isCentered() ? 0.5 : 0.0, &fEnd);
- return false;
+ // create some overlapping
+ fEndOverlap = getEnd().getWidth() / 15.0;
}
- basegfx::B2DRange PolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ if (0.0 != fStart || 0.0 != fEnd)
{
- if(getStart().isActive() || getEnd().isActive())
- {
- // use decomposition when line start/end is used
- return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
- }
- else
- {
- // get range from parent
- return PolygonStrokePrimitive2D::getB2DRange(rViewInformation);
- }
+ // build new poly, consume something from old poly
+ aLocalPolygon
+ = basegfx::utils::getSnippetAbsolute(aLocalPolygon, fStart - fStartOverlap,
+ fPolyLength - fEnd + fEndOverlap, fPolyLength);
}
+ }
+
+ // add shaft
+ rContainer.push_back(
+ new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute()));
+
+ if (aArrowA.count())
+ {
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor()));
+ }
+
+ if (aArrowB.count())
+ {
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor()));
+ }
+}
+
+PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd)
+ : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute)
+ , maStart(rStart)
+ , maEnd(rEnd)
+{
+}
+
+PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute,
+ const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd)
+ : PolygonStrokePrimitive2D(rPolygon, rLineAttribute)
+ , maStart(rStart)
+ , maEnd(rEnd)
+{
+}
+
+bool PolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+ if (PolygonStrokePrimitive2D::operator==(rPrimitive))
+ {
+ const PolygonStrokeArrowPrimitive2D& rCompare
+ = static_cast<const PolygonStrokeArrowPrimitive2D&>(rPrimitive);
+
+ return (getStart() == rCompare.getStart() && getEnd() == rCompare.getEnd());
+ }
+
+ return false;
+}
+
+basegfx::B2DRange PolygonStrokeArrowPrimitive2D::getB2DRange(
+ const geometry::ViewInformation2D& rViewInformation) const
+{
+ if (getStart().isActive() || getEnd().isActive())
+ {
+ // use decomposition when line start/end is used
+ return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
+ }
+ else
+ {
+ // get range from parent
+ return PolygonStrokePrimitive2D::getB2DRange(rViewInformation);
+ }
+}
- // provide unique ID
- ImplPrimitive2DIDBlock(PolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D)
+// provide unique ID
+ImplPrimitive2DIDBlock(PolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D)
} // end of namespace
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 4ec89ee96039..ee8dcf12b344 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3684,7 +3684,6 @@ drawinglayer/source/primitive2d/pagehierarchyprimitive2d.cxx
drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
-drawinglayer/source/primitive2d/polygonprimitive2d.cxx
drawinglayer/source/primitive2d/primitivetools2d.cxx
drawinglayer/source/primitive2d/sceneprimitive2d.cxx
drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx
commit e8a1283bdb91e717675258b178b33043f67101bd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Jul 17 15:09:49 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 13 08:54:43 2020 +0200
Revert "hack for gradients split into adjacent polygons (tdf#133016)"
This reverts commit 777ac5456a1f24fea29931ede983b5b8ad9a063d.
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index e6906a638084..d3e32e22ea46 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -30,7 +30,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <sal/log.hxx>
#include <cmath>
-#include <vcl/skia/SkiaHelper.hxx>
+
using namespace com::sun::star;
@@ -868,12 +868,6 @@ namespace drawinglayer::primitive2d
// use color distance and discrete lengths to calculate step count
const sal_uInt32 nSteps(calculateStepsForSvgGradient(getColorA(), getColorB(), fDelta, fDiscreteUnit));
- // HACK: Splitting a gradient into adjacent polygons with gradually changing color is silly.
- // If antialiasing is used to draw them, the AA-ed adjacent edges won't line up perfectly
- // because of the AA (see SkiaSalGraphicsImpl::mergePolyPolygonToPrevious()).
- // Make the polygons a bit wider, so they the partial overlap "fixes" this.
- const double fixup = SkiaHelper::isVCLSkiaEnabled() ? fDiscreteUnit / 2 : 0;
-
// tdf#117949 Use a small amount of discrete overlap at the edges. Usually this
// should be exactly 0.0 and 1.0, but there were cases when this gets clipped
// against the mask polygon which got numerically problematic.
@@ -887,7 +881,7 @@ namespace drawinglayer::primitive2d
basegfx::B2DRange(
getOffsetA() - fDiscreteUnit,
-0.0001, // TTTT -> should be 0.0, see comment above
- getOffsetA() + (fDelta / nSteps) + fDiscreteUnit + fixup,
+ getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
1.0001))); // TTTT -> should be 1.0, see comment above
// prepare loop (inside to outside, [0.0 .. 1.0[)
commit 0d1ca4fda8e38bf97794324e266b37b31e9b6da1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Jul 17 12:50:48 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 13 08:54:43 2020 +0200
drawinglayer: PolygonWavePrimitive2D needs to be exported
Change-Id: I4346e1dd574e1b37e66d55d11084243ea9160257
diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
index ac56461e35b0..57a37b60814f 100644
--- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d
This is one of the non-decomposable primitives, so a renderer
should process it.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D
{
private:
/// the hairline geometry
@@ -76,7 +76,7 @@ public:
It will be decomposed to the needed PolygonHairlinePrimitive2D if
not handled directly by a renderer.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonMarkerPrimitive2D final
: public BufferedDecompositionPrimitive2D
{
private:
@@ -131,7 +131,7 @@ public:
and stroke attributes. It will be decomposed dependent on the definition
to the needed primitives, e.g. filled PolyPolygons for fat lines.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
{
private:
/// the line geometry
@@ -180,7 +180,7 @@ public:
This primitive defines a waveline based on a PolygonStrokePrimitive2D
where the wave is defined by wave width and wave length.
*/
-class PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D
{
private:
/// wave definition
@@ -225,7 +225,8 @@ public:
possibly extended by start and end definitions, which are
normally used for arrows.
*/
-class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D final : public PolygonStrokePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC PolygonStrokeArrowPrimitive2D final
+ : public PolygonStrokePrimitive2D
{
private:
/// geometric definitions for line start and end
commit 3cf6b4ab1b6b3ee205761273ba03ae445b2cef87
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jul 14 22:44:13 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 13 08:54:42 2020 +0200
remove texteffectprimitive2d.{cxx,hxx} from clang-format blacklist
Change-Id: I57a47358d5e4f1e41fc1c89884b7603d8afdc3bd
diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
index ac2343220316..9a856c9f6f59 100644
--- a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
@@ -20,79 +20,79 @@
#pragma once
#include <drawinglayer/drawinglayerdllapi.h>
-
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-
namespace drawinglayer::primitive2d
- {
- /** TextEffectStyle2D definition */
- enum class TextEffectStyle2D
- {
- ReliefEmbossedDefault,
- ReliefEngravedDefault,
- ReliefEmbossed,
- ReliefEngraved,
- Outline
- };
-
- /** TextEffectPrimitive2D class
-
- This primitive embeds text primitives (normally, as can be seen can
- also be used for any other primitives) which have some TextEffect applied
- and create the needed geometry and embedding on decomposition.
- */
- class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D
- {
- private:
- /// the text (or other) content
- Primitive2DContainer maTextContent;
-
- /// the style to apply, the direction and the rotation center
- const basegfx::B2DPoint maRotationCenter;
- double mfDirection;
- TextEffectStyle2D meTextEffectStyle2D;
-
- /** the last used object to view transformtion used from getDecomposition
- for decide buffering
- */
- basegfx::B2DHomMatrix maLastObjectToViewTransformation;
-
- /// create local decomposition
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
-
- public:
- /// constructor
- TextEffectPrimitive2D(
- const Primitive2DContainer& rTextContent,
- const basegfx::B2DPoint& rRotationCenter,
- double fDirection,
- TextEffectStyle2D eTextEffectStyle2D);
-
- /// data read access
- const Primitive2DContainer& getTextContent() const { return maTextContent; }
- const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
- double getDirection() const { return mfDirection; }
- TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
-
- /// compare operator
- virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
-
- /** own get range implementation to solve more effective. Content is by definition displaced
- by a fixed discrete unit, thus the contained geometry needs only once be asked for its
- own basegfx::B2DRange
- */
- virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
-
- /// provide unique ID
- virtual sal_uInt32 getPrimitive2DID() const override;
-
- /// Override standard getDecomposition to be view-dependent here
- virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
- };
-
-} // end of namespace drawinglayer::primitive2d
-
+{
+/** TextEffectStyle2D definition */
+enum class TextEffectStyle2D
+{
+ ReliefEmbossedDefault,
+ ReliefEngravedDefault,
+ ReliefEmbossed,
+ ReliefEngraved,
+ Outline
+};
+
+/** TextEffectPrimitive2D class
+
+ This primitive embeds text primitives (normally, as can be seen can
+ also be used for any other primitives) which have some TextEffect applied
+ and create the needed geometry and embedding on decomposition.
+*/
+class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D
+{
+private:
+ /// the text (or other) content
+ Primitive2DContainer maTextContent;
+
+ /// the style to apply, the direction and the rotation center
+ const basegfx::B2DPoint maRotationCenter;
+ double mfDirection;
+ TextEffectStyle2D meTextEffectStyle2D;
+
+ /** the last used object to view transformtion used from getDecomposition
+ for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+
+ /// create local decomposition
+ virtual void
+ create2DDecomposition(Primitive2DContainer& rContainer,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+ /// constructor
+ TextEffectPrimitive2D(const Primitive2DContainer& rTextContent,
+ const basegfx::B2DPoint& rRotationCenter, double fDirection,
+ TextEffectStyle2D eTextEffectStyle2D);
+
+ /// data read access
+ const Primitive2DContainer& getTextContent() const { return maTextContent; }
+ const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
+ double getDirection() const { return mfDirection; }
+ TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+ /** own get range implementation to solve more effective. Content is by definition displaced
+ by a fixed discrete unit, thus the contained geometry needs only once be asked for its
+ own basegfx::B2DRange
+ */
+ virtual basegfx::B2DRange
+ getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+
+ /// provide unique ID
+ virtual sal_uInt32 getPrimitive2DID() const override;
+
+ /// Override standard getDecomposition to be view-dependent here
+ virtual void
+ get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const override;
+};
+
+} // end of namespace primitive2d::drawinglayer
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
index abfe28e3ecca..fbd3dfd14332 100644
--- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
@@ -24,222 +24,213 @@
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
-
namespace drawinglayer::primitive2d
{
- const double fDiscreteSize(1.1);
+const double fDiscreteSize(1.1);
- void TextEffectPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+void TextEffectPrimitive2D::create2DDecomposition(
+ Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+{
+ // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to
+ // have good results on rotated objects, too
+ const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(fDiscreteSize, fDiscreteSize));
+ const basegfx::B2DVector aDiagonalDistance(aDistance * (1.0 / 1.44));
+
+ switch (getTextEffectStyle2D())
+ {
+ case TextEffectStyle2D::ReliefEmbossed:
+ case TextEffectStyle2D::ReliefEngraved:
+ case TextEffectStyle2D::ReliefEmbossedDefault:
+ case TextEffectStyle2D::ReliefEngravedDefault:
{
- // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to
- // have good results on rotated objects, too
- const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation() *
- basegfx::B2DVector(fDiscreteSize, fDiscreteSize));
- const basegfx::B2DVector aDiagonalDistance(aDistance * (1.0 / 1.44));
-
- switch(getTextEffectStyle2D())
+ // prepare transform of sub-group back to (0,0) and align to X-Axis
+ basegfx::B2DHomMatrix aBackTransform(basegfx::utils::createTranslateB2DHomMatrix(
+ -getRotationCenter().getX(), -getRotationCenter().getY()));
+ aBackTransform.rotate(-getDirection());
+
+ // prepare transform of sub-group back to its position and rotation
+ basegfx::B2DHomMatrix aForwardTransform(
+ basegfx::utils::createRotateB2DHomMatrix(getDirection()));
+ aForwardTransform.translate(getRotationCenter().getX(), getRotationCenter().getY());
+
+ // create transformation for one discrete unit
+ const bool bEmbossed(TextEffectStyle2D::ReliefEmbossed == getTextEffectStyle2D()
+ || TextEffectStyle2D::ReliefEmbossedDefault
+ == getTextEffectStyle2D());
+ const bool bDefaultTextColor(
+ TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D()
+ || TextEffectStyle2D::ReliefEngravedDefault == getTextEffectStyle2D());
+ basegfx::B2DHomMatrix aTransform(aBackTransform);
+
+ if (bEmbossed)
{
- case TextEffectStyle2D::ReliefEmbossed:
- case TextEffectStyle2D::ReliefEngraved:
- case TextEffectStyle2D::ReliefEmbossedDefault:
- case TextEffectStyle2D::ReliefEngravedDefault:
- {
- // prepare transform of sub-group back to (0,0) and align to X-Axis
- basegfx::B2DHomMatrix aBackTransform(basegfx::utils::createTranslateB2DHomMatrix(
- -getRotationCenter().getX(), -getRotationCenter().getY()));
- aBackTransform.rotate(-getDirection());
-
- // prepare transform of sub-group back to its position and rotation
- basegfx::B2DHomMatrix aForwardTransform(basegfx::utils::createRotateB2DHomMatrix(getDirection()));
- aForwardTransform.translate(getRotationCenter().getX(), getRotationCenter().getY());
-
- // create transformation for one discrete unit
- const bool bEmbossed(
- TextEffectStyle2D::ReliefEmbossed == getTextEffectStyle2D()
- || TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D());
- const bool bDefaultTextColor(
- TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D()
- || TextEffectStyle2D::ReliefEngravedDefault == getTextEffectStyle2D());
- basegfx::B2DHomMatrix aTransform(aBackTransform);
-
- if(bEmbossed)
- {
- // to bottom-right
- aTransform.translate(aDiagonalDistance.getX(), aDiagonalDistance.getY());
- }
- else
- {
- // to top-left
- aTransform.translate(-aDiagonalDistance.getX(), -aDiagonalDistance.getY());
- }
-
- aTransform *= aForwardTransform;
-
- if(bDefaultTextColor)
- {
- // emboss/engrave in black, original forced to white
- const basegfx::BColorModifierSharedPtr aBColorModifierToGray =
- std::make_shared<basegfx::BColorModifier_replace>(
- basegfx::BColor(0.0));
- const Primitive2DReference xModifiedColor(
- new ModifiedColorPrimitive2D(
- getTextContent(),
- aBColorModifierToGray));
-
- rContainer.push_back(
- new TransformPrimitive2D(
- aTransform,
- Primitive2DContainer { xModifiedColor }));
-
- // add original, too
- const basegfx::BColorModifierSharedPtr aBColorModifierToWhite =
- std::make_shared<basegfx::BColorModifier_replace>(
- basegfx::BColor(1.0));
-
- rContainer.push_back(
- new ModifiedColorPrimitive2D(
- getTextContent(),
- aBColorModifierToWhite));
- }
- else
- {
- // emboss/engrave in gray, keep original's color
- const basegfx::BColorModifierSharedPtr aBColorModifierToGray =
- std::make_shared<basegfx::BColorModifier_replace>(
- basegfx::BColor(0.75)); // 192
- const Primitive2DReference xModifiedColor(
- new ModifiedColorPrimitive2D(
- getTextContent(),
- aBColorModifierToGray));
-
- rContainer.push_back(
- new TransformPrimitive2D(
- aTransform,
- Primitive2DContainer { xModifiedColor }));
-
- // add original, too
- rContainer.push_back(new GroupPrimitive2D(getTextContent()));
- }
-
- break;
- }
- case TextEffectStyle2D::Outline:
- {
- // create transform primitives in all directions
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.set(0, 2, aDistance.getX());
- aTransform.set(1, 2, 0.0);
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, aDiagonalDistance.getX());
- aTransform.set(1, 2, aDiagonalDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, 0.0);
- aTransform.set(1, 2, aDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, -aDiagonalDistance.getX());
- aTransform.set(1, 2, aDiagonalDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, -aDistance.getX());
- aTransform.set(1, 2, 0.0);
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, -aDiagonalDistance.getX());
- aTransform.set(1, 2, -aDiagonalDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, 0.0);
- aTransform.set(1, 2, -aDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- aTransform.set(0, 2, aDiagonalDistance.getX());
- aTransform.set(1, 2, -aDiagonalDistance.getY());
- rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
-
- // at last, place original over it, but force to white
- const basegfx::BColorModifierSharedPtr aBColorModifierToWhite =
- std::make_shared<basegfx::BColorModifier_replace>(
- basegfx::BColor(1.0, 1.0, 1.0));
- rContainer.push_back(
- new ModifiedColorPrimitive2D(
- getTextContent(),
- aBColorModifierToWhite));
-
- break;
- }
+ // to bottom-right
+ aTransform.translate(aDiagonalDistance.getX(), aDiagonalDistance.getY());
+ }
+ else
+ {
+ // to top-left
+ aTransform.translate(-aDiagonalDistance.getX(), -aDiagonalDistance.getY());
}
- }
- TextEffectPrimitive2D::TextEffectPrimitive2D(
- const Primitive2DContainer& rTextContent,
- const basegfx::B2DPoint& rRotationCenter,
- double fDirection,
- TextEffectStyle2D eTextEffectStyle2D)
- : BufferedDecompositionPrimitive2D(),
- maTextContent(rTextContent),
- maRotationCenter(rRotationCenter),
- mfDirection(fDirection),
- meTextEffectStyle2D(eTextEffectStyle2D)
- {
- }
+ aTransform *= aForwardTransform;
- bool TextEffectPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(BasePrimitive2D::operator==(rPrimitive))
+ if (bDefaultTextColor)
{
- const TextEffectPrimitive2D& rCompare = static_cast<const TextEffectPrimitive2D&>(rPrimitive);
+ // emboss/engrave in black, original forced to white
+ const basegfx::BColorModifierSharedPtr aBColorModifierToGray
+ = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor(0.0));
+ const Primitive2DReference xModifiedColor(
+ new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray));
- return (getTextContent() == rCompare.getTextContent()
- && getRotationCenter() == rCompare.getRotationCenter()
- && getDirection() == rCompare.getDirection()
- && getTextEffectStyle2D() == rCompare.getTextEffectStyle2D());
+ rContainer.push_back(
+ new TransformPrimitive2D(aTransform, Primitive2DContainer{ xModifiedColor }));
+
+ // add original, too
+ const basegfx::BColorModifierSharedPtr aBColorModifierToWhite
+ = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor(1.0));
+
+ rContainer.push_back(
+ new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite));
+ }
+ else
+ {
+ // emboss/engrave in gray, keep original's color
+ const basegfx::BColorModifierSharedPtr aBColorModifierToGray
+ = std::make_shared<basegfx::BColorModifier_replace>(
+ basegfx::BColor(0.75)); // 192
+ const Primitive2DReference xModifiedColor(
+ new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray));
+
+ rContainer.push_back(
+ new TransformPrimitive2D(aTransform, Primitive2DContainer{ xModifiedColor }));
+
+ // add original, too
+ rContainer.push_back(new GroupPrimitive2D(getTextContent()));
}
- return false;
+ break;
}
-
- basegfx::B2DRange TextEffectPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ case TextEffectStyle2D::Outline:
{
- // get range of content and grow by used fDiscreteSize. That way it is not necessary to ask
- // the whole decomposition for its ranges (which may be expensive with outline mode which
- // then will ask 9 times at nearly the same content. This may even be refined here using the
- // TextEffectStyle information, e.g. for TEXTEFFECTSTYLE2D_RELIEF the grow needs only to
- // be in two directions
- basegfx::B2DRange aRetval(getTextContent().getB2DRange(rViewInformation));
- aRetval.grow(fDiscreteSize);
-
- return aRetval;
- }
+ // create transform primitives in all directions
+ basegfx::B2DHomMatrix aTransform;
- void TextEffectPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
- {
- ::osl::MutexGuard aGuard( m_aMutex );
+ aTransform.set(0, 2, aDistance.getX());
+ aTransform.set(1, 2, 0.0);
+ rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
- if(!getBuffered2DDecomposition().empty())
- {
- if(maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
- {
- // conditions of last local decomposition have changed, delete
- const_cast< TextEffectPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
- }
- }
+ aTransform.set(0, 2, aDiagonalDistance.getX());
+ aTransform.set(1, 2, aDiagonalDistance.getY());
+ rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent()));
- if(getBuffered2DDecomposition().empty())
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list