summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-07-12 19:04:21 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-08-14 11:18:33 +0000
commitcc8f9f46f08a576f5c6a7e1538c1d9a21cc029ac (patch)
treea683fe8edd9c9d8e49f5eb485a31eb27fe587c38 /drawinglayer
parenta0e98a12f8979286f2418606cfa4f75fcbc63b6e (diff)
fdo#51688 fdo#66745: drawinglayer: properly restore anti-aliasing mode
VclPixelProcessor2D: the constructor changes the anti-aliasing mode of the given output device, and the destructor restores a hard-coded mode instead of what was there before. Due to this commit 5913506b2193e93ca2767ab7365ab2e76ed7848f turned off anti-aliasing for FontWork objects simply by creating a temporary VclPixelProcessor2D. Change-Id: I7f7fcbf86b0dd425f599cd8e62fce3c69a2744bb (cherry picked from commit 420aa16af0bbab4bdef80ceeb8d44cabe65840e0) Reviewed-on: https://gerrit.libreoffice.org/5393 Reviewed-by: Tor Lillqvist <tml@iki.fi> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx5
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx20
2 files changed, 21 insertions, 4 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx
index c3003f096467..f280da72ccdc 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx
@@ -25,6 +25,8 @@
#include <drawinglayer/processor2d/vclprocessor2d.hxx>
#include <vcl/outdev.hxx>
+#include <boost/scoped_ptr.hpp>
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -40,6 +42,9 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC VclPixelProcessor2D : public VclProcessor2D
{
private:
+ struct Impl;
+ boost::scoped_ptr<Impl> m_pImpl;
+
protected:
/* the local processor for BasePrinitive2D-Implementation based primitives,
called from the common process()-implementation
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 87c76e202b8a..2e0a6cdd11df 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -62,8 +62,18 @@ namespace drawinglayer
{
namespace processor2d
{
+ struct VclPixelProcessor2D::Impl
+ {
+ sal_uInt16 m_nOrigAntiAliasing;
+
+ explicit Impl(OutputDevice const& rOutDev)
+ : m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
+ { }
+ };
+
VclPixelProcessor2D::VclPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev)
- : VclProcessor2D(rViewInformation, rOutDev)
+ : VclProcessor2D(rViewInformation, rOutDev)
+ , m_pImpl(new Impl(rOutDev))
{
// prepare maCurrentTransformation matrix with viewTransformation to target directly to pixels
maCurrentTransformation = rViewInformation.getObjectToViewTransformation();
@@ -75,11 +85,13 @@ namespace drawinglayer
// react on AntiAliasing settings
if(getOptionsDrawinglayer().IsAntiAliasing())
{
- mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW);
+ mpOutputDevice->SetAntialiasing(
+ m_pImpl->m_nOrigAntiAliasing | ANTIALIASING_ENABLE_B2DDRAW);
}
else
{
- mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
+ mpOutputDevice->SetAntialiasing(
+ m_pImpl->m_nOrigAntiAliasing & ~ANTIALIASING_ENABLE_B2DDRAW);
}
}
@@ -89,7 +101,7 @@ namespace drawinglayer
mpOutputDevice->Pop();
// restore AntiAliasing
- mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
+ mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing);
}
void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)