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

Caolán McNamara caolanm at redhat.com
Wed Jan 3 18:55:08 UTC 2018


 lotuswordpro/source/filter/lwpgrfobj.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 20ac7089ad833d0d70c8c3e88a58d20a88530c42
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 3 15:19:47 2018 +0000

    ofz#4909 Direct-leak
    
    Change-Id: I16f2fd93bbc416a5677f8bbe02e22b4615599eaa
    Reviewed-on: https://gerrit.libreoffice.org/47323
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 4d596c82dd3e..aaa7f688c6c6 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -442,18 +442,18 @@ void LwpGraphicObject::CreateGrafObject()
     rtl::Reference<XFImage> pImage = new XFImage();
 
     // set image processing styles
-    XFImageStyle* pImageStyle = new XFImageStyle();
+    std::unique_ptr<XFImageStyle> xImageStyle(new XFImageStyle);
     if (m_sServerContextFormat[1]!='w' || m_sServerContextFormat[2]!='m' || m_sServerContextFormat[3]!='f')
     {
         if (m_aIPData.nBrightness != 50)
         {
             sal_Int32 nSODCBrightness = (sal_Int32)m_aIPData.nBrightness*2 - 100;
-            pImageStyle->SetBrightness(nSODCBrightness);
+            xImageStyle->SetBrightness(nSODCBrightness);
         }
         if (m_aIPData.nContrast != 50)
         {
             sal_Int32 nSODCContrast = (sal_Int32)(80 - (double)m_aIPData.nContrast*1.6);
-            pImageStyle->SetContrast(nSODCContrast);
+            xImageStyle->SetContrast(nSODCContrast);
         }
     }
 
@@ -542,8 +542,8 @@ void LwpGraphicObject::CreateGrafObject()
             if (pMyFrameLayout->GetScaleCenter() || pMyFrameLayout->GetScaleTile())
             {
                 // set center alignment
-                pImageStyle->SetXPosType(enumXFFrameXPosCenter, enumXFFrameXRelFrame);
-                pImageStyle->SetYPosType(enumXFFrameYPosMiddle, enumXFFrameYRelFrame);
+                xImageStyle->SetXPosType(enumXFFrameXPosCenter, enumXFFrameXRelFrame);
+                xImageStyle->SetYPosType(enumXFFrameYPosMiddle, enumXFFrameYRelFrame);
 
                 // need horizontal crop?
                 double fClipWidth = 0;
@@ -564,7 +564,7 @@ void LwpGraphicObject::CreateGrafObject()
 
                 if (sal_bCropped)
                 {
-                    pImageStyle->SetClip(fClipWidth, fClipWidth, fClipHeight, fClipHeight);
+                    xImageStyle->SetClip(fClipWidth, fClipWidth, fClipHeight, fClipHeight);
                     pImage->SetWidth(fDisFrameWidth);
                     pImage->SetHeight(fDisFrameHeight);
                 }
@@ -573,8 +573,8 @@ void LwpGraphicObject::CreateGrafObject()
             else
             {
                 // set left-top alignment
-                pImageStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
-                pImageStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
+                xImageStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
+                xImageStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
 
                 // get image position offset
                 LwpPoint& rOffset = pMyScale->GetOffset();
@@ -635,7 +635,7 @@ void LwpGraphicObject::CreateGrafObject()
                         aCropRect.fBottom = (aImageRect.fBottom - aFrameRect.fBottom) / fYRatio;
                     }
 
-                    pImageStyle->SetClip(aCropRect.fLeft, aCropRect.fRight, aCropRect.fTop, aCropRect.fBottom);
+                    xImageStyle->SetClip(aCropRect.fLeft, aCropRect.fRight, aCropRect.fTop, aCropRect.fBottom);
                     double fPicWidth = fSclGrafWidth - (aCropRect.fLeft+aCropRect.fRight)*fXRatio;
                     double fPicHeight = fSclGrafHeight- (aCropRect.fTop+aCropRect.fBottom)*fYRatio;
                     double fX = fOffsetX > 0 ? fOffsetX : 0.00;
@@ -648,7 +648,7 @@ void LwpGraphicObject::CreateGrafObject()
 
     // set style for the image
     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
-    pImage->SetStyleName(pXFStyleManager->AddStyle(pImageStyle).m_pStyle->GetStyleName());
+    pImage->SetStyleName(pXFStyleManager->AddStyle(xImageStyle.release()).m_pStyle->GetStyleName());
 
     // set anchor to frame
     pImage->SetAnchorType(enumXFAnchorFrame);


More information about the Libreoffice-commits mailing list