summaryrefslogtreecommitdiff
path: root/vcl/source/outdev
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-09-25 13:30:11 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-09-29 09:54:42 +0200
commit4deadc3c78949c18bb886eb1f66caa8f3cd7a2df (patch)
treec6c17519268c9adaf382f2dd07f71787e2d8cff5 /vcl/source/outdev
parentcd85546a2fbdade42f80fd3b6bd650791db9f32d (diff)
disentangle AA and B2D use in VCL drawing
A number of powerful functions using B2D polygons such as OutputDevice::DrawPolyLineDirect() were used only if AA was enabled. So e.g. dashing for an AA-ed polyline could be drawn directly using the function, but with AA disabled had to be done manually by a number of polygon operations. Which doesn't make much sense, surely these powerful functions can also draw without AA if set so (and indeed that's mostly the case). And DrawPolyLineDirect() even had a flag to bypass the check. So simply try to use B2D-based drawing whenever possible, AA or not. The previous commit had already changed the naming of the AA option to not include B2D in the name. This seems to come from https://bz.apache.org/ooo/show_bug.cgi?id=88795, which doesn't explain why AA only. There are other bugreports such as https://bz.apache.org/ooo/show_bug.cgi?id=101491 and https://bz.apache.org/ooo/show_bug.cgi?id=98289 that are related, but there I cannot see any difference with this patch. And all unit tests pass. Change-Id: Ibb5938e8fff9b7452bac4bf12ed3e42fd3e5d645 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103354 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r--vcl/source/outdev/line.cxx10
-rw-r--r--vcl/source/outdev/polygon.cxx9
-rw-r--r--vcl/source/outdev/polyline.cxx35
-rw-r--r--vcl/source/outdev/transparent.cxx3
4 files changed, 17 insertions, 40 deletions
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index 6507c43408ed..f965f0fdd1fc 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -108,8 +108,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
InitLineColor();
// #i101598# support AA and snap for lines, too
- if((mnAntialiasing & AntialiasingFlags::Enable)
- && mpGraphics->supportsOperation(OutDevSupportType::B2DDraw)
+ if( mpGraphics->supportsOperation(OutDevSupportType::B2DDraw)
&& RasterOp::OverPaint == GetRasterOp()
&& IsLineColor())
{
@@ -151,8 +150,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const LineInfo& rInfo )
{
- const bool bTryAA((mnAntialiasing & AntialiasingFlags::Enable)
- && mpGraphics->supportsOperation(OutDevSupportType::B2DDraw)
+ const bool bTryB2d(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw)
&& RasterOp::OverPaint == GetRasterOp()
&& IsLineColor());
basegfx::B2DPolyPolygon aFillPolyPolygon;
@@ -234,7 +232,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
bool bDone(false);
- if(bTryAA)
+ if(bTryB2d)
{
bDone = mpGraphics->DrawPolyLine(
basegfx::B2DHomMatrix(),
@@ -272,7 +270,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
bool bDone(false);
- if(bTryAA)
+ if(bTryB2d)
{
bDone = mpGraphics->DrawPolyPolygon(
basegfx::B2DHomMatrix(),
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 996af41c0506..4d76578d376a 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -62,8 +62,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
InitFillColor();
// use b2dpolygon drawing if possible
- if((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
+ if(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
RasterOp::OverPaint == GetRasterOp() &&
(IsLineColor() || IsFillColor()))
{
@@ -182,8 +181,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly )
InitFillColor();
// use b2dpolygon drawing if possible
- if((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
+ if(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
RasterOp::OverPaint == GetRasterOp() &&
(IsLineColor() || IsFillColor()))
{
@@ -292,8 +290,7 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
bool bSuccess(false);
- if((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
+ if(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
RasterOp::OverPaint == GetRasterOp() &&
(IsLineColor() || IsFillColor()))
{
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index e9b01f987f80..e52e42cc8ce6 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -117,8 +117,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly, const LineInfo& rL
// #i101491#
// Try direct Fallback to B2D-Version of DrawPolyLine
- if((mnAntialiasing & AntialiasingFlags::Enable) &&
- LineStyle::Solid == rLineInfo.GetStyle())
+ if(LineStyle::Solid == rLineInfo.GetStyle())
{
DrawPolyLine(
rPoly.getB2DPolygon(),
@@ -219,25 +218,13 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
SetFillColor(aOldFillColor);
InitFillColor();
- const bool bTryAA((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
- RasterOp::OverPaint == GetRasterOp() &&
- IsLineColor());
-
// when AA it is necessary to also paint the filled polygon's outline
// to avoid optical gaps
for(auto const& rPolygon : aAreaPolyPolygon)
{
(void)DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
- rPolygon,
- 0.0,
- 0.0,
- nullptr, // MM01
- basegfx::B2DLineJoin::NONE,
- css::drawing::LineCap_BUTT,
- basegfx::deg2rad(15.0) /*default, not used*/,
- bTryAA);
+ rPolygon);
}
}
else
@@ -308,11 +295,10 @@ bool OutputDevice::DrawPolyLineDirect(
const std::vector< double >* pStroke, // MM01
basegfx::B2DLineJoin eLineJoin,
css::drawing::LineCap eLineCap,
- double fMiterMinimumAngle,
- bool bBypassAACheck)
+ double fMiterMinimumAngle)
{
if(DrawPolyLineDirectInternal(rObjectTransform, rB2DPolygon, fLineWidth, fTransparency,
- pStroke, eLineJoin, eLineCap, fMiterMinimumAngle, bBypassAACheck))
+ pStroke, eLineJoin, eLineCap, fMiterMinimumAngle))
{
// Worked, add metafile action (if recorded). This is done only here,
// because this function is public, other OutDev functions already add metafile
@@ -342,8 +328,7 @@ bool OutputDevice::DrawPolyLineDirectInternal(
const std::vector< double >* pStroke, // MM01
basegfx::B2DLineJoin eLineJoin,
css::drawing::LineCap eLineCap,
- double fMiterMinimumAngle,
- bool bBypassAACheck)
+ double fMiterMinimumAngle)
{
assert(!is_double_buffered_window());
@@ -364,13 +349,11 @@ bool OutputDevice::DrawPolyLineDirectInternal(
if( mbInitLineColor )
InitLineColor();
- const bool bTryAA( bBypassAACheck ||
- ((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
+ const bool bTryB2d(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
RasterOp::OverPaint == GetRasterOp() &&
- IsLineColor()));
+ IsLineColor());
- if(bTryAA)
+ if(bTryB2d)
{
// combine rObjectTransform with WorldToDevice
const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation() * rObjectTransform);
@@ -395,7 +378,7 @@ bool OutputDevice::DrawPolyLineDirectInternal(
if (mpAlphaVDev)
mpAlphaVDev->DrawPolyLineDirect(rObjectTransform, rB2DPolygon, fLineWidth,
fTransparency, pStroke, eLineJoin, eLineCap,
- fMiterMinimumAngle, bBypassAACheck);
+ fMiterMinimumAngle);
return true;
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index e7864820b6ba..b2496a726086 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -232,8 +232,7 @@ void OutputDevice::DrawTransparent(
if( mbInitFillColor )
InitFillColor();
- if((mnAntialiasing & AntialiasingFlags::Enable) &&
- mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
+ if(mpGraphics->supportsOperation(OutDevSupportType::B2DDraw) &&
(RasterOp::OverPaint == GetRasterOp()) )
{
// b2dpolygon support not implemented yet on non-UNX platforms