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

Jochen Nitschke j.nitschke+logerrit at ok.de
Mon Sep 11 06:35:52 UTC 2017


 sc/source/ui/view/output2.cxx |   52 ++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

New commits:
commit 58edb05341494dfaa3d3ce33505b97961d5f2ea9
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Sep 10 22:43:53 2017 +0200

    cppcheck: knownConditionTrueFalse 'bClip' is always true
    
    always true since initial import in year 2000
    
    Change-Id: I66596f50580d2db29b5aee0617164a56e8635806
    Reviewed-on: https://gerrit.libreoffice.org/42146
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index a5b0dfece4a9..8ac4e24845c6 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -4997,7 +4997,6 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
 
                             if (!bHidden)
                             {
-                                bool bClip = false;
                                 Size aClipSize( nScrX+nScrW-nStartX, nScrY+nScrH-nStartY );
 
                                 // go on writing
@@ -5090,33 +5089,27 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
                                     }
                                 }
 
-                                bClip = true;       // always clip at the window/page border
-
-                                //Rectangle aClipRect;
-                                if (bClip)
+                                if ( nAttrRotate /* && eRotMode != SVX_ROTATE_MODE_STANDARD */ )
                                 {
-                                    if ( nAttrRotate /* && eRotMode != SVX_ROTATE_MODE_STANDARD */ )
-                                    {
-                                        // only clip rotated output text at the page border
-                                        nClipStartX = nScrX;
-                                        aClipSize.Width() = nScrW;
-                                    }
+                                    // only clip rotated output text at the page border
+                                    nClipStartX = nScrX;
+                                    aClipSize.Width() = nScrW;
+                                }
 
-                                    if (bPixelToLogic)
-                                        aAreaParam.maClipRect = mpRefDevice->PixelToLogic( tools::Rectangle(
-                                                        Point(nClipStartX,nClipStartY), aClipSize ) );
-                                    else
-                                        aAreaParam.maClipRect = tools::Rectangle(Point(nClipStartX, nClipStartY),
-                                                                aClipSize );    // Scale = 1
+                                if (bPixelToLogic)
+                                    aAreaParam.maClipRect = mpRefDevice->PixelToLogic( tools::Rectangle(
+                                                    Point(nClipStartX,nClipStartY), aClipSize ) );
+                                else
+                                    aAreaParam.maClipRect = tools::Rectangle(Point(nClipStartX, nClipStartY),
+                                                            aClipSize );    // Scale = 1
 
-                                    if (bMetaFile)
-                                    {
-                                        mpDev->Push();
-                                        mpDev->IntersectClipRegion( aAreaParam.maClipRect );
-                                    }
-                                    else
-                                        mpDev->SetClipRegion( vcl::Region( aAreaParam.maClipRect ) );
+                                if (bMetaFile)
+                                {
+                                    mpDev->Push();
+                                    mpDev->IntersectClipRegion( aAreaParam.maClipRect );
                                 }
+                                else
+                                    mpDev->SetClipRegion( vcl::Region( aAreaParam.maClipRect ) );
 
                                 Point aLogicStart;
                                 if (bPixelToLogic)
@@ -5285,13 +5278,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
 
                                 pEngine->Draw( mpDev, aLogicStart, (short)nOriVal );
 
-                                if (bClip)
-                                {
-                                    if (bMetaFile)
-                                        mpDev->Pop();
-                                    else
-                                        mpDev->SetClipRegion();
-                                }
+                                if (bMetaFile)
+                                    mpDev->Pop();
+                                else
+                                    mpDev->SetClipRegion();
                             }
                         }
                     }


More information about the Libreoffice-commits mailing list