summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-09 09:18:00 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-10 08:49:28 +0200
commitc42b28be2cbeac75c9ea53a2d74ea044fddad468 (patch)
tree5cfb6e256c967638f26c478889abbfd453912218 /basegfx
parent8a27eeb12b1700e9a3f181addc28e6282a11f1e3 (diff)
drawinglayer: avoid AA for hairline polygons built from hori/vert lines only
For one, it seems this was the intention already since commit 85c70f37b56299f6fa02312c0fb73cc55af084ef (CWS-TOOLING: integrate CWS aw063, 2009-03-04): "suppress AntiAliasing for pure horizontal or vertical lines". For another, this fixes the TileCacheTests::testTileWireIDHandling() testcase in online.git, which assumes that the indicators at the corners of the Writer body frame (paragraph marks hidden / default case) can be painted multiple times, producing pixel-by-pixel matching results. But in reality AA breaks that assumption, and we know these indicators are never diagonal lines. (cherry picked from commit f8b4d371eddd27594d549fb00294c01229a9bd24) Conflicts: basegfx/test/B2DPolygonTest.cxx Change-Id: Ib74f823165799991296b64cee58ec106dbdcedcf Reviewed-on: https://gerrit.libreoffice.org/72032 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 644e08bb6358..046463e8f141 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -456,6 +456,24 @@ namespace basegfx
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)
{
// config here