diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-09-21 16:42:01 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-09-21 20:12:09 +0200 |
commit | 80b287ad0322afcbf8f80b0507e212870dcf0f98 (patch) | |
tree | 7710bc62dfc82d4b77d2f1de3beb55599c4e3527 /vcl/unx/generic | |
parent | c8b2849d140677f7b35523096eb2bc715b3dc507 (diff) |
Support buffering SystemDependent GraphicData
Started to make the buffering more flexible by adding
virtual methods
virtual sal_uInt32 getHoldCyclesInSeconds() const;
virtual sal_Int64 estimateUsageInBytes() const;
to class SystemDependentData. This will allow to add more
sensitive buffering/caching.
Also fine-tuned Linux-derived classes actively used for buffering
to be more sensitive when and where to reuse the buffered data
Change-Id: Ifc69c318ade0209aff071d76001869d9f4eeb10d
Reviewed-on: https://gerrit.libreoffice.org/60881
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 8b0742b4ec68..582c3c147efe 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -1651,26 +1651,45 @@ bool X11SalGraphicsImpl::drawFilledTriangles( class SystemDependentData_Triangulation : public basegfx::SystemDependentData { private: + // the triangulation itself basegfx::triangulator::B2DTriangleVector maTriangles; + + // all other values the triangulation is based on and + // need to be compared with to check for data validity basegfx::B2DVector maLineWidth; + basegfx::B2DLineJoin meJoin; + css::drawing::LineCap meCap; + double mfMiterMinimumAngle; public: SystemDependentData_Triangulation( basegfx::SystemDependentDataManager& rSystemDependentDataManager, const basegfx::triangulator::B2DTriangleVector& rTriangles, - const basegfx::B2DVector& rLineWidth); + const basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin eJoin, + css::drawing::LineCap eCap, + double fMiterMinimumAngle); const basegfx::triangulator::B2DTriangleVector& getTriangles() const { return maTriangles; } const basegfx::B2DVector& getLineWidth() const { return maLineWidth; } + const basegfx::B2DLineJoin& getJoin() const { return meJoin; } + const css::drawing::LineCap& getCap() const { return meCap; } + double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } }; SystemDependentData_Triangulation::SystemDependentData_Triangulation( basegfx::SystemDependentDataManager& rSystemDependentDataManager, const basegfx::triangulator::B2DTriangleVector& rTriangles, - const basegfx::B2DVector& rLineWidth) + const basegfx::B2DVector& rLineWidth, + basegfx::B2DLineJoin eJoin, + css::drawing::LineCap eCap, + double fMiterMinimumAngle) : basegfx::SystemDependentData(rSystemDependentDataManager), maTriangles(rTriangles), - maLineWidth(rLineWidth) + maLineWidth(rLineWidth), + meJoin(eJoin), + meCap(eCap), + mfMiterMinimumAngle(fMiterMinimumAngle) { } @@ -1716,7 +1735,19 @@ bool X11SalGraphicsImpl::drawPolyLine( if(pSystemDependentData_Triangulation) { - // check data validity + // check data validity (I) + if(pSystemDependentData_Triangulation->getJoin() != eLineJoin + || pSystemDependentData_Triangulation->getCap() != eLineCap + || pSystemDependentData_Triangulation->getMiterMinimumAngle() != fMiterMinimumAngle) + { + // data invalid, forget + pSystemDependentData_Triangulation.reset(); + } + } + + if(pSystemDependentData_Triangulation) + { + // check data validity (II) if(pSystemDependentData_Triangulation->getLineWidth() != aLineWidth) { // sometimes small inconsistencies, use a percentage tolerance @@ -1774,11 +1805,16 @@ bool X11SalGraphicsImpl::drawPolyLine( if(!aTriangles.empty()) { - // add to buffering mechanism + // Add to buffering mechanism + // Add all values the triangulation is based off, too, to check for + // validity (see above) pSystemDependentData_Triangulation = rPolygon.addOrReplaceSystemDependentData<SystemDependentData_Triangulation>( ImplGetSystemDependentDataManager(), aTriangles, - aLineWidth); + aLineWidth, + eLineJoin, + eLineCap, + fMiterMinimumAngle); } } |