Revert "drawinglayer: avoid AA for hairline polygons built from ...
.. hori/vert lines only" This reverts commitf8b4d371ed
. Tomaz considers this ugly and it's no longer needed since commit93abdf39b0
(sw lok: assume no windows in SwLayoutFrame::PaintSwFrame(), 2019-05-14). Conflicts: basegfx/test/B2DPolygonTest.cxx Change-Id: Ia9b29921ff3e5d82085e1abf9f39c172357a5e13 Reviewed-on: https://gerrit.libreoffice.org/72297 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -416,24 +416,6 @@ namespace basegfx
|
|||||||
return aRetval;
|
return aRetval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool containsOnlyHorizontalOrVerticalLines(const basegfx::B2DPolygon& rPolygon)
|
|
||||||
{
|
|
||||||
if (rPolygon.count() <= 1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (size_t i = 1; i < rPolygon.count(); ++i)
|
|
||||||
{
|
|
||||||
const basegfx::B2DPoint& rPrevPoint = rPolygon.getB2DPoint(i - 1);
|
|
||||||
const basegfx::B2DPoint& rPoint = rPolygon.getB2DPoint(i);
|
|
||||||
if (rPrevPoint.getX() == rPoint.getX() || rPrevPoint.getY() == rPoint.getY())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments)
|
B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments)
|
||||||
{
|
{
|
||||||
// config here
|
// config here
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
|
||||||
#include <basegfx/point/b2dpoint.hxx>
|
#include <basegfx/point/b2dpoint.hxx>
|
||||||
|
|
||||||
namespace basegfx
|
namespace basegfx
|
||||||
@@ -79,30 +78,12 @@ public:
|
|||||||
aPoly.getB2DPoint(1));
|
aPoly.getB2DPoint(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testContainsOnlyHorizontalOrVerticalLines()
|
|
||||||
{
|
|
||||||
// First line is horizontal, second is vertical.
|
|
||||||
B2DPolygon aPoly;
|
|
||||||
aPoly.append(B2DPoint(0, 1));
|
|
||||||
aPoly.append(B2DPoint(1, 1));
|
|
||||||
aPoly.append(B2DPoint(1, 0));
|
|
||||||
CPPUNIT_ASSERT(utils::containsOnlyHorizontalOrVerticalLines(aPoly));
|
|
||||||
|
|
||||||
// First line is diagonal, second is vertical.
|
|
||||||
aPoly.clear();
|
|
||||||
aPoly.append(B2DPoint(0, 0));
|
|
||||||
aPoly.append(B2DPoint(1, 1));
|
|
||||||
aPoly.append(B2DPoint(1, 0));
|
|
||||||
CPPUNIT_ASSERT(!utils::containsOnlyHorizontalOrVerticalLines(aPoly));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change the following lines only, if you add, remove or rename
|
// Change the following lines only, if you add, remove or rename
|
||||||
// member functions of the current class,
|
// member functions of the current class,
|
||||||
// because these macros are need by auto register mechanism.
|
// because these macros are need by auto register mechanism.
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(b2dpolygon);
|
CPPUNIT_TEST_SUITE(b2dpolygon);
|
||||||
CPPUNIT_TEST(testBasics);
|
CPPUNIT_TEST(testBasics);
|
||||||
CPPUNIT_TEST(testContainsOnlyHorizontalOrVerticalLines);
|
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
}; // class b2dpolygon
|
}; // class b2dpolygon
|
||||||
|
|
||||||
|
@@ -140,16 +140,6 @@ namespace drawinglayer
|
|||||||
mpOutputDevice->SetLineColor(Color(aLineColor));
|
mpOutputDevice->SetLineColor(Color(aLineColor));
|
||||||
//aLocalPolygon.transform(maCurrentTransformation);
|
//aLocalPolygon.transform(maCurrentTransformation);
|
||||||
|
|
||||||
if (getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete())
|
|
||||||
{
|
|
||||||
if (basegfx::utils::containsOnlyHorizontalOrVerticalLines(rLocalPolygon))
|
|
||||||
{
|
|
||||||
// DrawPolyLineDirect() only works in AA mode, but pure horizontal or vertical
|
|
||||||
// lines are better with AA off.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// try drawing; if it did not work, use standard fallback
|
// try drawing; if it did not work, use standard fallback
|
||||||
return mpOutputDevice->DrawPolyLineDirect(
|
return mpOutputDevice->DrawPolyLineDirect(
|
||||||
maCurrentTransformation,
|
maCurrentTransformation,
|
||||||
|
@@ -331,7 +331,6 @@ namespace drawinglayer
|
|||||||
basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
|
basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
|
||||||
aLocalPolygon.transform(maCurrentTransformation);
|
aLocalPolygon.transform(maCurrentTransformation);
|
||||||
|
|
||||||
bool bDisableAA = false;
|
|
||||||
if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete())
|
if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete())
|
||||||
{
|
{
|
||||||
// #i98289#
|
// #i98289#
|
||||||
@@ -340,18 +339,9 @@ namespace drawinglayer
|
|||||||
// not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This
|
// not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This
|
||||||
// NEEDS to be done in discrete coordinates, so only useful for pixel based rendering.
|
// NEEDS to be done in discrete coordinates, so only useful for pixel based rendering.
|
||||||
aLocalPolygon = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon);
|
aLocalPolygon = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon);
|
||||||
|
|
||||||
// Also disable AA, snap would leave the start/end of lines still anti-aliased when
|
|
||||||
// their coordinates are provided in logic units.
|
|
||||||
bDisableAA = basegfx::utils::containsOnlyHorizontalOrVerticalLines(aLocalPolygon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AntialiasingFlags nOriginalAA(mpOutputDevice->GetAntialiasing());
|
|
||||||
if (bDisableAA && (nOriginalAA & AntialiasingFlags::EnableB2dDraw))
|
|
||||||
mpOutputDevice->SetAntialiasing(nOriginalAA & ~AntialiasingFlags::EnableB2dDraw);
|
|
||||||
mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0);
|
mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0);
|
||||||
if (bDisableAA && (nOriginalAA & AntialiasingFlags::EnableB2dDraw))
|
|
||||||
mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() | AntialiasingFlags::EnableB2dDraw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// direct draw of transformed BitmapEx primitive
|
// direct draw of transformed BitmapEx primitive
|
||||||
|
@@ -445,9 +445,6 @@ namespace basegfx
|
|||||||
*/
|
*/
|
||||||
BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
|
BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
|
||||||
|
|
||||||
/// Determines if rPolygon lacks diagonal lines or not.
|
|
||||||
BASEGFX_DLLPUBLIC bool containsOnlyHorizontalOrVerticalLines(const basegfx::B2DPolygon& rPolygon);
|
|
||||||
|
|
||||||
/// get the tangent with which the given point is entered seen from the previous
|
/// get the tangent with which the given point is entered seen from the previous
|
||||||
/// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
|
/// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
|
||||||
BASEGFX_DLLPUBLIC B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
|
BASEGFX_DLLPUBLIC B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
|
||||||
|
Reference in New Issue
Block a user