[Libreoffice-commits] core.git: Branch 'feature/fixes22' - sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu May 26 15:24:30 UTC 2016


 sw/inc/ndgrf.hxx                 |    2 --
 sw/source/core/graphic/ndgrf.cxx |   19 ++-----------------
 2 files changed, 2 insertions(+), 19 deletions(-)

New commits:
commit 31b9c10a5efd3261227f2d45890bb6975824258b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu May 26 17:22:43 2016 +0200

    Revert "sw: speed up saving of swapped out non-SVG images"
    
    This reverts commit a578aab11e13ed9963f1f04ac7ed0138dbff2829. In its
    current form it trades an export slowdown for an import slowdown. I
    didn't notice that side-effect earlier.

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 5f0041e..7b960c9 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -38,8 +38,6 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode
 
     GraphicObject maGrfObj;
     GraphicObject *mpReplacementGraphic;
-    /// If false, don't try to read a replacement graphic even if mpReplacementGraphic is nullptr.
-    bool mbHasReplacementGraphic;
     tools::SvRef<sfx2::SvBaseLink> refLink;       ///< If graphics only as link then pointer is set.
     Size nGrfSize;
     bool bInSwapIn              :1;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index d62291d..d50ac70 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -69,7 +69,6 @@ SwGrfNode::SwGrfNode(
     SwNoTextNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
     maGrfObj(),
     mpReplacementGraphic(nullptr),
-    mbHasReplacementGraphic(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -80,10 +79,6 @@ SwGrfNode::SwGrfNode(
 
     bGraphicArrived = true;
     ReRead(rGrfName, rFltName, pGraphic, nullptr, false);
-
-    const SvgDataPtr& rSvgDataPtr = GetGrf().getSvgData();
-    if (!rSvgDataPtr.get())
-        mbHasReplacementGraphic = false;
 }
 
 SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
@@ -92,7 +87,6 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
     SwNoTextNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
     maGrfObj(rGrfObj),
     mpReplacementGraphic(nullptr),
-    mbHasReplacementGraphic(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -101,10 +95,6 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
     bInSwapIn = bChgTwipSize  =
         bFrameInPaint = bScaleImageMap = false;
     bGraphicArrived = true;
-
-    const SvgDataPtr& rSvgDataPtr = GetGrf().getSvgData();
-    if (!rSvgDataPtr.get())
-        mbHasReplacementGraphic = false;
 }
 
 /** Create new SW/G reader.
@@ -120,7 +110,6 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
     SwNoTextNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
     maGrfObj(),
     mpReplacementGraphic(nullptr),
-    mbHasReplacementGraphic(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -340,12 +329,12 @@ void SwGrfNode::onGraphicChanged()
     // when it is set.
     SwFlyFrameFormat* pFlyFormat = dynamic_cast< SwFlyFrameFormat* >(GetFlyFormat());
 
-    const SvgDataPtr& rSvgDataPtr = GetGrf().getSvgData();
     if(pFlyFormat)
     {
         OUString aName;
         OUString aTitle;
         OUString aDesc;
+        const SvgDataPtr& rSvgDataPtr = GetGrf().getSvgData();
 
         if(rSvgDataPtr.get())
         {
@@ -383,8 +372,6 @@ void SwGrfNode::onGraphicChanged()
             SetDescription(aDesc);
         }
     }
-    if (!rSvgDataPtr.get())
-        mbHasReplacementGraphic = false;
 }
 
 void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink)
@@ -407,9 +394,7 @@ const GraphicObject& SwGrfNode::GetGrfObj(bool bWait) const
 
 const GraphicObject* SwGrfNode::GetReplacementGrfObj() const
 {
-    // Don't attempt potentially expensive GetGrfObj() that may trigger a
-    // SwapIn() in case we know that getSvgData() will be nullptr anyway.
-    if(!mpReplacementGraphic && mbHasReplacementGraphic)
+    if(!mpReplacementGraphic)
     {
         const SvgDataPtr& rSvgDataPtr = GetGrfObj().GetGraphic().getSvgData();
 


More information about the Libreoffice-commits mailing list