[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 18 18:36:50 UTC 2020


 vcl/source/window/paint.cxx |   43 +++++--------------------------------------
 1 file changed, 5 insertions(+), 38 deletions(-)

New commits:
commit 3af6ac85d13986aa619b4d33c39f1b964be9778b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 18 15:12:30 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 18 20:36:12 2020 +0200

    only the first comphelper::LibreOfficeKit::isActive() branch is used
    
    since...
    
    commit 63f320f6352bfca0dcd7ed0b55b95e8bc27d8d67
    Date:   Mon Aug 13 13:27:21 2018 +0200
    
        lokit: Draw dialogs without using a MetaFile
    
    if comphelper::LibreOfficeKit::isActive is true the top block will return so
    the code inside the following comphelper::LibreOfficeKit::isActive block can't
    be called, which was introduced by
    
    commit d6a2dc03806c4e7c0be8e4f2aee272f036f4765e
    Date:   Sat Feb 10 17:31:44 2018 +0100
    
        lokdialog: Render non-pixel based preview windows
    
    Change-Id: I857f92a69bc9b592df7a810aa11cb0979aac3718
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96613
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 7bd98672b5cb..e1d281e71948 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1451,29 +1451,9 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
     bool bOutput = IsOutputEnabled();
     EnableOutput();
 
-    double fScaleX = 1;
-    double fScaleY = 1;
-    bool bNeedsScaling = false;
-    if(comphelper::LibreOfficeKit::isActive())
-    {
-        if(GetMapMode().GetMapUnit() != MapUnit::MapPixel &&
-        // Some of the preview windows (SvxPreviewBase) uses different painting (drawinglayer primitives)
-        // For these preview we don't need to scale even though the unit is not pixel.
-        GetMapMode().GetMapUnit() != MapUnit::Map100thMM)
-        {
-            bNeedsScaling = true;
-            // 1000.0 is used to reduce rounding imprecision (Size uses integers)
-            Size aLogicSize = PixelToLogic(Size(1000.0, 1000.0));
-            fScaleX = aLogicSize.Width() / 1000.0;
-            fScaleY = aLogicSize.Height() / 1000.0;
-        }
-    }
-    else
-    {   // TODO: Above scaling was added for LOK only, would be good to check how it works in other use cases
-        SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
-        if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
-            return;
-    }
+    SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
+    if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
+        return;
 
     // preserve graphicsstate
     Push();
@@ -1522,18 +1502,9 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
     else
         SetRefPoint();
     SetLayoutMode( GetLayoutMode() );
-    SetDigitLanguage( GetDigitLanguage() );
 
-    tools::Rectangle aPaintRect;
-    if(bNeedsScaling)
-    {
-        aPaintRect = tools::Rectangle( Point( 0, 0 ),
-            Size(GetOutputSizePixel().Width() * fScaleX, GetOutputSizePixel().Height() * fScaleY)  );
-    }
-    else
-    {
-        aPaintRect = tools::Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
-    }
+    SetDigitLanguage( GetDigitLanguage() );
+    tools::Rectangle aPaintRect(Point(0, 0), GetOutputSizePixel());
     aClipRegion.Intersect( aPaintRect );
     SetClipRegion( aClipRegion );
 
@@ -1543,8 +1514,6 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
     if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & ParentClipMode::NoClip ) )
     {
         Erase(*this);
-        if(bNeedsScaling)
-            aMtf.Scale(fScaleX, fScaleY);
     }
     // foreground
     Paint(*this, aPaintRect);
@@ -1560,8 +1529,6 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
                                                 DeviceFormat::DEFAULT,
                                                 DeviceFormat::DEFAULT);
 
-    if(bNeedsScaling)
-        pMaskedDevice->SetMapMode( GetMapMode() );
     pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
     pMaskedDevice->EnableRTL( IsRTLEnabled() );
     aMtf.WindStart();


More information about the Libreoffice-commits mailing list