svx/source/dialog/dlgctrl.cxx |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

New commits:
commit 70492ce8b0fd4e03b0beff9b72f00a718394937c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Aug 29 11:45:49 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Aug 29 14:31:38 2018 +0200

    match preview buffer device mapmode and pixel size
    
    Change-Id: Ie5ac758b788357e1d54ea3dc5abd233ff9e4abf0
    Reviewed-on: https://gerrit.libreoffice.org/59762
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index dce8c6d4b4b0..aee18ab17494 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -2213,13 +2213,8 @@ void PreviewBase::LocalPrePaint(vcl::RenderContext const 
& rRenderContext)
 {
     // init BufferDevice
     if (mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
-    {
-        mpBufferDevice->SetDrawMode(rRenderContext.GetDrawMode());
-        mpBufferDevice->SetSettings(rRenderContext.GetSettings());
-        mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing());
         mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
-        mpBufferDevice->SetMapMode(rRenderContext.GetMapMode());
-    }
+    mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing());
 
     const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
 
@@ -2275,9 +2270,7 @@ XRectPreview::XRectPreview()
 // in e.g. page dialog
 tools::Rectangle XRectPreview::GetPreviewSize() const
 {
-    tools::Rectangle aObjectSize(Point(), GetOutputSizePixel());
-    aObjectSize.AdjustRight(1);
-    aObjectSize.AdjustBottom(1);
+    tools::Rectangle aObjectSize(Point(), 
getBufferDevice().PixelToLogic(GetOutputSizePixel()));
     return aObjectSize;
 }
 
@@ -2287,9 +2280,7 @@ void XRectPreview::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
     InitSettings();
 
     // create RectangleObject
-    mpRectangleObject = new SdrRectObj(
-        getModel(),
-        GetPreviewSize());
+    mpRectangleObject = new SdrRectObj(getModel(), GetPreviewSize());
 }
 
 void XRectPreview::Resize()
@@ -2297,9 +2288,7 @@ void XRectPreview::Resize()
     SdrObject *pOrigObject = mpRectangleObject;
     if (pOrigObject)
     {
-        mpRectangleObject = new SdrRectObj(
-            getModel(),
-            GetPreviewSize());
+        mpRectangleObject = new SdrRectObj(getModel(), GetPreviewSize());
         SetAttributes(pOrigObject->GetMergedItemSet());
         SdrObject::Free(pOrigObject);
     }
@@ -2319,6 +2308,8 @@ void XRectPreview::SetAttributes(const SfxItemSet& 
rItemSet)
 
 void XRectPreview::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
 {
+    rRenderContext.Push(PushFlags::MAPMODE);
+    rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM));
     LocalPrePaint(rRenderContext);
 
     sdr::contact::SdrObjectVector aObjectVector;
@@ -2331,6 +2322,7 @@ void XRectPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rectan
     aPainter.ProcessDisplay(aDisplayInfo);
 
     LocalPostPaint(rRenderContext);
+    rRenderContext.Pop();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to