[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - oox/source

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 10 08:13:31 UTC 2021


 oox/source/drawingml/fillproperties.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 47e2c2f428c870de12b7a99c7bcb249a3a3b86ea
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Tue Feb 23 16:41:15 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 10 09:12:55 2021 +0100

    Prevent the unnecessary lclCropGraphic call.
    
    In case text::GraphicCrop aGraphCrop( 0, 0, 0, 0 )
    we don't need to call lclCropGraphic.
    
    Change-Id: I9960900f9b5c5b770824c76ffeb9ec9b51cbaef3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111401
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112240

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index a4eedfaa6d63..88be3e9eb0f3 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -773,7 +773,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                                 aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * aFillRect.Y2 ) / 100000 );
                             rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop);
 
-                            if(bIsCustomShape)
+                            if(bIsCustomShape &&
+                               ( aGraphCrop.Left != 0 || aGraphCrop.Right != 0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0))
                             {
                                 xGraphic = lclCropGraphic(xGraphic, aFillRect);
                                 rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic);
@@ -879,17 +880,17 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
                 if ( oClipRect.Y2 )
                     aGraphCrop.Bottom = rtl::math::round( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 );
                 rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop);
-            }
 
-            if(mbIsCustomShape)
-            {
-                geometry::IntegerRectangle2D aCropRect = oClipRect;
-                lclCalculateCropPercentage(xGraphic, aCropRect);
-                xGraphic = lclCropGraphic(xGraphic, aCropRect);
+                if(mbIsCustomShape &&
+                   ( aGraphCrop.Left != 0 || aGraphCrop.Right != 0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0))
+                {
+                    geometry::IntegerRectangle2D aCropRect = oClipRect;
+                    lclCalculateCropPercentage(xGraphic, aCropRect);
+                    xGraphic = lclCropGraphic(xGraphic, aCropRect);
 
-                rPropMap.setProperty(PROP_FillBitmap, xGraphic);
+                    rPropMap.setProperty(PROP_FillBitmap, xGraphic);
+                }
             }
-
         }
 
         if(mbIsCustomShape)


More information about the Libreoffice-commits mailing list