diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-10-16 15:00:00 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-10-20 19:21:06 +0200 |
commit | b8a609e798a83a40e5ceb5873d6a95dfd93bfb83 (patch) | |
tree | 9eeba3207b19f645a5092f4c298efa26d14e53c2 /canvas | |
parent | 15a040d925bc9640e34ab728d683b22c47d3514f (diff) |
do not disable AA in vclcanvas if Skia is used
Perhaps AA may not look good with GDI or Xlib VCL, but with Skia
it is fine (and if it's not, I'll fix it).
Also avoid the repeated copy&paste.
Change-Id: I7aa60ae1e1c8a2ab4fa93d08ab0dfeb23c9c2cb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104437
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/vcl/backbuffer.cxx | 12 | ||||
-rw-r--r-- | canvas/source/vcl/bitmapbackbuffer.cxx | 13 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.cxx | 18 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.hxx | 1 | ||||
-rw-r--r-- | canvas/source/vcl/spritedevicehelper.cxx | 12 |
5 files changed, 25 insertions, 31 deletions
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 0ddf0344ea73..c2779cdf0489 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -22,6 +22,7 @@ #include <vcl/svapp.hxx> #include "backbuffer.hxx" +#include "impltools.hxx" namespace vclcanvas @@ -34,16 +35,7 @@ namespace vclcanvas if( bMonochromeBuffer ) return; - // #i95645# -#if defined( MACOSX ) - // use AA on VCLCanvas for Mac - maVDev->SetAntialiasing( AntialiasingFlags::Enable | maVDev->GetAntialiasing() ); -#else - // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and - // is not required to do AA. It would need to be adapted to use it correctly - // (especially gradient painting). This will need extra work. - maVDev->SetAntialiasing( maVDev->GetAntialiasing() & ~AntialiasingFlags::Enable); -#endif + tools::SetDefaultDeviceAntiAliasing( maVDev ); } BackBuffer::~BackBuffer() diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index 4ac6d1a7b95e..337e0bae7c2e 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -24,7 +24,7 @@ #include <vcl/svapp.hxx> #include "bitmapbackbuffer.hxx" - +#include "impltools.hxx" namespace vclcanvas { @@ -120,16 +120,7 @@ namespace vclcanvas mpVDev->SetOutputSizePixel( maBitmap->GetSizePixel() ); - // #i95645# -#if defined( MACOSX ) - // use AA on VCLCanvas for Mac - mpVDev->SetAntialiasing( AntialiasingFlags::Enable | mpVDev->GetAntialiasing() ); -#else - // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and - // is not required to do AA. It would need to be adapted to use it correctly - // (especially gradient painting). This will need extra work. - mpVDev->SetAntialiasing(mpVDev->GetAntialiasing() & ~AntialiasingFlags::Enable); -#endif + tools::SetDefaultDeviceAntiAliasing( mpVDev ); } void BitmapBackBuffer::updateVDev() const diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 754a34ce0806..a76fefcb40c7 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -33,6 +33,7 @@ #include <vcl/canvastools.hxx> #include <vcl/BitmapTools.hxx> #include <vcl/metric.hxx> +#include <vcl/skia/SkiaHelper.hxx> #include <canvas/canvastools.hxx> @@ -216,6 +217,23 @@ namespace vclcanvas::tools return vcl::bitmap::CanvasTransformBitmap(rBitmap, rTransform, aDestRect, aLocalTransform); } + + void SetDefaultDeviceAntiAliasing( OutputDevice* pDevice ) + { +#if defined( MACOSX ) + // use AA on VCLCanvas for Mac + pDevice->SetAntialiasing( AntialiasingFlags::Enable | pDevice->GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + if( SkiaHelper::isVCLSkiaEnabled()) // But Skia handles AA fine. + pDevice->SetAntialiasing( AntialiasingFlags::Enable | pDevice->GetAntialiasing() ); + else + pDevice->SetAntialiasing(pDevice->GetAntialiasing() & ~AntialiasingFlags::Enable); +#endif + } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx index 8ac5a7e62d42..f8a9db075227 100644 --- a/canvas/source/vcl/impltools.hxx +++ b/canvas/source/vcl/impltools.hxx @@ -171,6 +171,7 @@ namespace vclcanvas ::BitmapEx transformBitmap( const BitmapEx& rBitmap, const ::basegfx::B2DHomMatrix& rTransform ); + void SetDefaultDeviceAntiAliasing( OutputDevice* pDevice ); } } diff --git a/canvas/source/vcl/spritedevicehelper.cxx b/canvas/source/vcl/spritedevicehelper.cxx index f123b31e4cfb..150e3fcb42af 100644 --- a/canvas/source/vcl/spritedevicehelper.cxx +++ b/canvas/source/vcl/spritedevicehelper.cxx @@ -25,6 +25,7 @@ #include <tools/stream.hxx> #include "spritedevicehelper.hxx" +#include "impltools.hxx" using namespace ::com::sun::star; @@ -44,16 +45,7 @@ namespace vclcanvas mpBackBuffer = std::make_shared<BackBuffer>( rOutDev ); mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() ); - // #i95645# -#if defined( MACOSX ) - // use AA on VCLCanvas for Mac - mpBackBuffer->getOutDev().SetAntialiasing( AntialiasingFlags::Enable | mpBackBuffer->getOutDev().GetAntialiasing() ); -#else - // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and - // is not required to do AA. It would need to be adapted to use it correctly - // (especially gradient painting). This will need extra work. - mpBackBuffer->getOutDev().SetAntialiasing(mpBackBuffer->getOutDev().GetAntialiasing() & ~AntialiasingFlags::Enable); -#endif + tools::SetDefaultDeviceAntiAliasing( &mpBackBuffer->getOutDev()); } bool SpriteDeviceHelper::showBuffer( bool, bool ) |