From 80b287ad0322afcbf8f80b0507e212870dcf0f98 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Fri, 21 Sep 2018 16:42:01 +0200 Subject: 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 --- vcl/unx/generic/gdi/gdiimpl.cxx | 48 +++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'vcl/unx/generic') 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( ImplGetSystemDependentDataManager(), aTriangles, - aLineWidth); + aLineWidth, + eLineJoin, + eLineCap, + fMiterMinimumAngle); } } -- cgit