diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-04 16:28:58 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-12 21:01:20 +0200 |
commit | f65cbae8947c0462b35c8d3c3d5124e431b100b6 (patch) | |
tree | e8248f034f7a97e1716f9477937b55ae31038a76 /include/drawinglayer | |
parent | fc55711f01af172eb3a034454405fa941454c781 (diff) |
borderline: correct problems with border display
Borderline display with direct paint and with primitive direct
paint has quite some errors in the current state. Started to
unify usages, check deeper with creation/usage.
borderline: deep changes to BorderLine
Found basic error in determining the offset values
for BorderLinePrimitive creation, these were not
centered on the lines. Corrected that. This makes
it possible to remove the formally used clipping
which seems to have been used to correct that. Also
allows to go back to a 'normal' decomposition that
creates line primitives as expected. That again can
then be painted quite normally.
Also added view-dependent case to the decomposition
to guarantee a gap of one discrete unit (pixel).
Removed the direct painter, too. Checked and corrected
stroking.
borderline: Adapted previews to primitives
Added code to use the primitive representation in
all dialogs and apps using tables. The edit views
use these mostly, so the preview should do that,
too. Currently missing is a good visualization of
diagonals, but this is also true for edit views.
Checked all apps and table usages to not get worse
borderline: correct line dash visualization
When a dashed line is used, a factor of 10.0 was applied in the
original coded, added that. Also the orientation of vertical
borders was inverted since it was simpler to exchange Start/End,
but this also mirrors the line dash visualisation, corrected that
Change-Id: I4c1b380a76cb37389fab1259a53fb7cc9da982d1
e95e246d5563360617a2a2213e4d5ec7d0e736b9
62369b4de58fb0264aeb710ec6983ceddca5701d
77418cc6c84ebb0632f8c3448976e82ce612d6b6
b4eb28dc86ce05eb89b26517167305b994158ef8
borderline: adapt cppunittest and clang
Diffstat (limited to 'include/drawinglayer')
-rw-r--r-- | include/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 26 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx | 65 |
2 files changed, 16 insertions, 75 deletions
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 4ac0a1045585..4645bde2a2c5 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -66,27 +66,29 @@ namespace drawinglayer bool mbHasGapColor; SvxBorderLineStyle mnStyle; - double mfPatternScale; - /// local helpers - double getWidth( - const geometry::ViewInformation2D& rViewInformation) const; + // for view dependent decomposition in the case with distance (gap), + // remember the last used concrete mfDistance, see get2DDecomposition + // implementation + double mfDiscreteDistance; + /// local helpers bool isInsideUsed() const { return !basegfx::fTools::equalZero(mfLeftWidth); } + bool isDistanceUsed() const + { + return !basegfx::fTools::equalZero(mfDistance); + } + bool isOutsideUsed() const { return !basegfx::fTools::equalZero(mfRightWidth); } - protected: - virtual basegfx::B2DPolyPolygon getClipPolygon( - const geometry::ViewInformation2D& rViewInformation) const; - /// create local decomposition virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; @@ -125,12 +127,16 @@ namespace drawinglayer bool hasGapColor( ) const { return mbHasGapColor; } SvxBorderLineStyle getStyle () const { return mnStyle; } double getPatternScale() const { return mfPatternScale; } - /// Same as create2DDecomposition(), but can do pixel correction if requested. - void createDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation, bool bPixelCorrection) const; + + /// helper to decide if AntiAliasing should be used + bool isHorizontalOrVertical(const geometry::ViewInformation2D& rViewInformation) const; /// 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/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx deleted file mode 100644 index 3fe2813be9a9..000000000000 --- a/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX - -#include <drawinglayer/drawinglayerdllapi.h> - -#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> - - -namespace drawinglayer -{ - namespace primitive2d - { - /** BorderLinePrimitive2D clipped by the intersection with a provided - polygon. - */ - class DRAWINGLAYER_DLLPUBLIC ClippedBorderLinePrimitive2D : public BorderLinePrimitive2D - { - private: - const basegfx::B2DPolygon maIntersection; - - protected: - virtual basegfx::B2DPolyPolygon getClipPolygon( - const geometry::ViewInformation2D& rViewInformation) const override; - - public: - /// constructor - ClippedBorderLinePrimitive2D( - const basegfx::B2DPoint& rStart, - const basegfx::B2DPoint& rEnd, - double fLeftWidth, - double fDistance, - double fRightWidth, - const basegfx::B2DPolygon& rIntersection, - const basegfx::BColor& rRGBColorRight, - const basegfx::BColor& rRGBColorLeft, - const basegfx::BColor& rRGBColorGap, - bool bHasGapColor, - SvxBorderLineStyle nStyle, - double fPatternScale ); - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// provide unique ID - DeclPrimitive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |