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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 25 17:14:48 UTC 2020


 vcl/inc/impgraph.hxx        |   11 ++++++-----
 vcl/source/gdi/impgraph.cxx |   19 ++++++++-----------
 2 files changed, 14 insertions(+), 16 deletions(-)

New commits:
commit fdf9b8600a634ed824220d14d9b246337ad08f9f
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Aug 18 15:41:25 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Sep 25 19:14:02 2020 +0200

    ImpGraphic: rename Impl{Read,Write}Embedded - used only in swapping
    
    ImplReadEmbedded and ImplWriteEmbedded are used when swapping only
    so rename it to swapInContent and swapOutContent.
    
    In addition change the swapInFromStream to accept SvStream by
    reference and not pointer.
    
    Change-Id: I2c555c436fe5eb6583d83382a2da278f4890ee08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103400
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index a65462a48819..9a82caade324 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -168,15 +168,16 @@ private:
     sal_uInt32          ImplGetAnimationLoopCount() const;
 
 private:
+    // swapping methods
+    bool swapInFromStream(SvStream& rStream);
+
+    bool swapInContent(SvStream& rStream);
+    bool swapOutContent(SvStream& rStream);
+    // end swapping
 
     std::shared_ptr<GraphicReader>& ImplGetContext() { return mpContext;}
     void                ImplSetContext( const std::shared_ptr<GraphicReader>& pReader );
     void                ImplSetDummyContext( bool value ) { mbDummyContext = value; }
-    bool                ImplReadEmbedded( SvStream& rIStream );
-    bool                ImplWriteEmbedded( SvStream& rOStream );
-
-    bool                swapInFromStream(SvStream* pIStm);
-
     bool                ImplIsDummyContext() const { return mbDummyContext; }
     void                ImplSetLink( const std::shared_ptr<GfxLink>& );
     std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 70609d0b31f8..8c608e4ec301 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1133,7 +1133,7 @@ void ImpGraphic::ImplSetContext( const std::shared_ptr<GraphicReader>& pReader )
     mbDummyContext = false;
 }
 
-bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
+bool ImpGraphic::swapInContent(SvStream& rIStm)
 {
     ensureAvailable();
 
@@ -1275,7 +1275,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
     return bRet;
 }
 
-bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
+bool ImpGraphic::swapOutContent(SvStream& rOStm)
 {
     ensureAvailable();
 
@@ -1381,7 +1381,7 @@ bool ImpGraphic::swapOut()
         xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
         xOutputStream->SetBufferSize(GRAPHIC_STREAMBUFSIZE);
 
-        if (!xOutputStream->GetError() && ImplWriteEmbedded(*xOutputStream))
+        if (!xOutputStream->GetError() && swapOutContent(*xOutputStream))
         {
             xOutputStream->Flush();
             bResult = !xOutputStream->GetError();
@@ -1473,7 +1473,7 @@ bool ImpGraphic::swapIn()
                 xIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
                 xIStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-                bRet = swapInFromStream(xIStm.get());
+                bRet = swapInFromStream(*xIStm);
                 xIStm.reset();
                 if (mpSwapFile)
                     setOriginURL(mpSwapFile->getOriginURL());
@@ -1488,16 +1488,13 @@ bool ImpGraphic::swapIn()
     return bRet;
 }
 
-bool ImpGraphic::swapInFromStream(SvStream* xIStm)
+bool ImpGraphic::swapInFromStream(SvStream& rStream)
 {
     bool bRet = false;
 
-    if( !xIStm )
-        return false;
-
-    xIStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+    rStream.SetBufferSize(GRAPHIC_STREAMBUFSIZE);
 
-    if( xIStm->GetError() )
+    if (rStream.GetError())
         return false;
 
     //keep the swap file alive, because its quite possibly the backing storage
@@ -1511,7 +1508,7 @@ bool ImpGraphic::swapInFromStream(SvStream* xIStm)
     bool bDummyContext = mbDummyContext;
     mbDummyContext = false;
 
-    bRet = ImplReadEmbedded( *xIStm );
+    bRet = swapInContent(rStream);
 
     //restore ownership of the swap file and context
     mpSwapFile = std::move(xSwapFile);


More information about the Libreoffice-commits mailing list