diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-10-25 10:06:05 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-10-25 12:43:55 +0200 |
commit | 313392119522c21a6ecd14403d6f92c948149df7 (patch) | |
tree | fbd1a112a41f83d34c6bb6ea79eeccf73dba3e7b /include | |
parent | 8dec85a3b3f4cbd46b03f707458347a25cc22c15 (diff) |
Reorganize FrameBorderPrimitive creation (II)
Step5: Move the view-dependent decomposition from
BorderLinePrimitive2D to SdrFrameBorderPrimitive2D.
It is now possible to use discrete sizes before the
line and edge matching is done what will look much
better. When it was done at BorderLinePrimitive2D
and the matching was already done, that match was
'displaced' with the adapted forced scale to discrete
units.
The space and size used when zooming out for a single
discrete unit (pixel) can heavily vary - it just covers
a much larger logical area than the 'real' line/poly
would do. All this needs to be handled (also for bound
ranges) and can only be in a good way using primitives.
Adapted to no longer do view-dependent changes in
BorderLinePrimitive2D. Adapted to do these now at
SdrFrameBorderPrimitive2D. Currently used to force
the existing border partial lines (up to three) to
not get taller than one logical unit.
Adapted to no longer switch off AntiAliased rendering
in VclPixelProcessor2D for processBorderLinePrimitive2D,
this is problematic with various renderers on various
systems (e.g. vcl still falls back to render multiple
one-pixel-lines when taller than 3.5 pixels which looks
horrible combined with other parts like filled polygons)
All this needs fine balancing on
- all systems
- all renderers
- all apps (which all have their own table implementation)
- all render targets (pixel/PDF/print/slideshow/...)
Done as thorough as possible, but may need additional
finetuning. May also be a motivation to move away from
vcl and implement these urgetly needed system-dependent
primitive renderers...
Adapted UnitTest testDoublePixelProcessing with the needed
comments.
Change-Id: Ie88bb76c2474b6ab3764d45a9cd1669264492acd
Reviewed-on: https://gerrit.libreoffice.org/62344
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 20 | ||||
-rw-r--r-- | include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx | 22 |
2 files changed, 22 insertions, 20 deletions
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index cb57e40fbe8a..a3f41985061e 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -38,7 +38,9 @@ namespace drawinglayer /** BorderLine class Helper class holding the style definition for a single part of a full BorderLine definition. Line extends are for start/end and for Left/Right, seen in vector direction. If - Left != Right that means the line has a diagonal start/end + Left != Right that means the line has a diagonal start/end. + Think about it similar to a trapezoid, but not aligned to X-Axis and using the + perpendicular vector to the given one in a right-handed coordinate system. */ class DRAWINGLAYER_DLLPUBLIC BorderLine { @@ -76,9 +78,6 @@ namespace drawinglayer double getEndRight() const { return mfEndRight; } bool isGap() const { return mbIsGap; } - /// helper to get adapted width (maximum) - double getAdaptedWidth(double fMinWidth) const; - /// compare operator bool operator==(const BorderLine& rBorderLine) const; }; @@ -111,18 +110,10 @@ namespace drawinglayer /// common style definitions const drawinglayer::attribute::StrokeAttribute maStrokeAttribute; - // for view dependent decomposition in the case with existing gaps, - // remember the smallest allowed concrete gap distance, see get2DDecomposition - // implementation - double mfSmallestAllowedDiscreteGapDistance; - /// create local decomposition virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; - /// helper to find smallest defined gap in maBorderLines - bool getSmallestGap(double& rfSmallestGap) const; - - /// helper to get the full width taking mfSmallestAllowedDiscreteGapDistance into account + /// helper to get the full width from maBorderLines double getFullWidth() const; public: @@ -145,9 +136,6 @@ namespace drawinglayer /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - /// Override standard getDecomposition to be view-dependent here - virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; - /// provide unique ID DeclPrimitive2DIDBlock() }; diff --git a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx index 29afb3584538..58f3b94cfd01 100644 --- a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx +++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx @@ -72,7 +72,11 @@ namespace drawinglayer const basegfx::B2DVector& rNormalizedPerpendicular, bool bStyleMirrored); - void create2DDecomposition(Primitive2DContainer& rContainer) const; + void create2DDecomposition( + Primitive2DContainer& rContainer, + double fMinDiscreteUnit) const; + + double getMinimalNonZeroBorderWidth() const; }; typedef std::vector<SdrFrameBorderData> SdrFrameBorderDataVector; @@ -88,7 +92,10 @@ namespace drawinglayer { private: std::shared_ptr<SdrFrameBorderDataVector> maFrameBorders; + double mfMinimalNonZeroBorderWidth; + double mfMinimalNonZeroBorderWidthUsedForDecompose; bool mbMergeResult; + bool mbForceToSingleDiscreteUnit; protected: // local decomposition. @@ -99,14 +106,21 @@ namespace drawinglayer public: SdrFrameBorderPrimitive2D( std::shared_ptr<SdrFrameBorderDataVector>& rFrameBorders, - bool bMergeResult); + bool bMergeResult, + bool bForceToSingleDiscreteUnit); // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + // override to get view-dependent + virtual void get2DDecomposition( + Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const override; + // data access - const SdrFrameBorderDataVector& getFrameBorders() const { return *maFrameBorders.get(); } - bool getMergeResult() const { return mbMergeResult; } + const std::shared_ptr<SdrFrameBorderDataVector>& getFrameBorders() const { return maFrameBorders; } + bool doMergeResult() const { return mbMergeResult; } + bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; } // provide unique ID DeclPrimitive2DIDBlock() |