[Libreoffice-commits] core.git: 2 commits - include/vcl solenv/clang-format vcl/inc vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 26 05:35:17 UTC 2020


 include/vcl/GraphicNativeMetadata.hxx        |    4 -
 include/vcl/GraphicNativeTransform.hxx       |    6 +-
 solenv/clang-format/blacklist                |    4 -
 vcl/inc/impgraph.hxx                         |   11 ++---
 vcl/source/filter/GraphicNativeMetadata.cxx  |   15 +++----
 vcl/source/filter/GraphicNativeTransform.cxx |   55 +++++++++++++--------------
 vcl/source/gdi/impgraph.cxx                  |   44 ++++++++++-----------
 vcl/source/graphic/Manager.cxx               |    6 +-
 8 files changed, 70 insertions(+), 75 deletions(-)

New commits:
commit 68fe3b96d94c314dfd944ebd5239384e2fed87a7
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Apr 18 21:40:12 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Apr 26 07:34:53 2020 +0200

    remove Impl from swap method names in ImpGraphic
    
    Change-Id: Ie235b6d02582d4d5ee3dc3d9d2be7f022bcb13c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92906
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8fa1df9b82fc..8dc3e21de640 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -175,13 +175,14 @@ private:
     bool                ImplReadEmbedded( SvStream& rIStream );
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
-    bool                ImplSwapIn();
-    bool                ImplSwapIn( SvStream* pIStm );
+    bool                swapIn();
+    bool                swapInFromStream(SvStream* pIStm);
 
-    bool                ImplSwapOut();
-    bool                ImplSwapOut( SvStream* pOStm );
+    bool                swapOut();
+    bool                swapOutToStream(SvStream* pOStm);
+
+    bool                isSwappedOut() const { return mbSwapOut;}
 
-    bool                ImplIsSwapOut() const { return mbSwapOut;}
     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 dd4f2cdebd58..8eb9e0346dd0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -330,7 +330,7 @@ const std::shared_ptr<VectorGraphicData>& ImpGraphic::getVectorGraphicData() con
 
 void ImpGraphic::ImplCreateSwapInfo()
 {
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
     {
         maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
         maSwapInfo.maPrefSize = ImplGetPrefSize();
@@ -737,7 +737,7 @@ Size ImpGraphic::ImplGetSizePixel() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
         aSize = maSwapInfo.maSizePixel;
     else
         aSize = ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
@@ -749,7 +749,7 @@ Size ImpGraphic::ImplGetPrefSize() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aSize = maSwapInfo.maPrefSize;
     }
@@ -847,7 +847,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
 {
     MapMode aMapMode;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aMapMode = maSwapInfo.maPrefMapMode;
     }
@@ -963,7 +963,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
 void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -1000,7 +1000,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
                            const Point& rDestPt, const Size& rDestSize ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -1043,7 +1043,7 @@ void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev, const Point& rDestPt
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Start( pOutDev, rDestPt, rDestSize, nExtraData, pFirstFrameOutDev );
 }
 
@@ -1051,7 +1051,7 @@ void ImpGraphic::ImplStopAnimation( OutputDevice* pOutDev, long nExtraData )
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Stop( pOutDev, nExtraData );
 }
 
@@ -1227,7 +1227,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 {
     ensureAvailable();
 
-    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || ImplIsSwapOut() )
+    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || isSwappedOut() )
         return false;
 
     const MapMode   aMapMode( ImplGetPrefMapMode() );
@@ -1300,10 +1300,10 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut()
+bool ImpGraphic::swapOut()
 {
 
-    if( ImplIsSwapOut() )
+    if( isSwappedOut() )
         return false;
 
     ::utl::TempFile     aTempFile;
@@ -1326,7 +1326,7 @@ bool ImpGraphic::ImplSwapOut()
     xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
     xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-    bool bRet = ImplSwapOut( xOStm.get() );
+    bool bRet = swapOutToStream( xOStm.get() );
     if( bRet )
     {
         mpSwapFile.reset(new ImpSwapFile, o3tl::default_delete<ImpSwapFile>());
@@ -1344,7 +1344,7 @@ bool ImpGraphic::ImplSwapOut()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut( SvStream* xOStm )
+bool ImpGraphic::swapOutToStream(SvStream* xOStm)
 {
     if( !xOStm )
     {
@@ -1375,8 +1375,8 @@ bool ImpGraphic::ensureAvailable() const
 {
     auto pThis = const_cast<ImpGraphic*>(this);
 
-    if (ImplIsSwapOut())
-        return pThis->ImplSwapIn();
+    if (isSwappedOut())
+        return pThis->swapIn();
 
     pThis->maLastUsed = std::chrono::high_resolution_clock::now();
     return true;
@@ -1405,11 +1405,11 @@ bool ImpGraphic::loadPrepared()
     return true;
 }
 
-bool ImpGraphic::ImplSwapIn()
+bool ImpGraphic::swapIn()
 {
     bool bRet = false;
 
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
         return bRet;
 
     if (mbPrepared)
@@ -1439,7 +1439,7 @@ bool ImpGraphic::ImplSwapIn()
                 xIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
                 xIStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-                bRet = ImplSwapIn( xIStm.get() );
+                bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
                     setOriginURL(mpSwapFile->maOriginURL);
@@ -1454,7 +1454,7 @@ bool ImpGraphic::ImplSwapIn()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapIn( SvStream* xIStm )
+bool ImpGraphic::swapInFromStream(SvStream* xIStm)
 {
     bool bRet = false;
 
@@ -1528,7 +1528,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
 
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() )
     {
         switch( meType )
         {
@@ -1565,7 +1565,7 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
 
     bool bResult = false;
 
-    if( !ImplIsSwapOut() )
+    if( !isSwappedOut() )
     {
         if( mpGfxLink && mpGfxLink->IsNative() )
             bResult = mpGfxLink->ExportNative( rOStm );
@@ -1758,7 +1758,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
 
     rImpGraphic.ensureAvailable();
 
-    if (rImpGraphic.ImplIsSwapOut())
+    if (rImpGraphic.isSwappedOut())
     {
         rOStm.SetError( SVSTREAM_GENERALERROR );
         return;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index b019d5adceaa..65e81fc1e605 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -93,7 +93,7 @@ void Manager::reduceGraphicMemory()
             return;
 
         sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic);
-        if (!pEachImpGraphic->ImplIsSwapOut() && nCurrentGraphicSize > 1000000)
+        if (!pEachImpGraphic->isSwappedOut() && nCurrentGraphicSize > 1000000)
         {
             if (!pEachImpGraphic->mpContext)
             {
@@ -102,7 +102,7 @@ void Manager::reduceGraphicMemory()
                 auto aSeconds = std::chrono::duration_cast<std::chrono::seconds>(aDeltaTime);
 
                 if (aSeconds > mnAllowedIdleTime)
-                    pEachImpGraphic->ImplSwapOut();
+                    pEachImpGraphic->swapOut();
             }
         }
     }
@@ -141,7 +141,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
     sal_Int64 calculatedSize = 0;
     for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
     {
-        if (!pEachImpGraphic->ImplIsSwapOut())
+        if (!pEachImpGraphic->isSwappedOut())
         {
             calculatedSize += getGraphicSizeBytes(pEachImpGraphic);
         }
commit 082b8718dfc70a7994990215f1dc51a69046788b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 15 22:05:33 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Apr 26 07:34:40 2020 +0200

    remove GraphicNative{Metadata,Transform} from clang-f. blacklist
    
    Change-Id: Ib60485e5d35e9d3ec2b0028d38fb8d5eaa72421c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92905
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index 118efa480df8..318fb724bf25 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -29,8 +29,8 @@ public:
     GraphicNativeMetadata();
     ~GraphicNativeMetadata();
 
-    bool read(Graphic const & rGraphic);
-    sal_uInt16 getRotation() const { return mRotation;}
+    bool read(Graphic const& rGraphic);
+    sal_uInt16 getRotation() const { return mRotation; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index 318327bf5b66..b4d71f2d53d0 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -29,9 +29,9 @@ class VCL_DLLPUBLIC GraphicNativeTransform final
 {
     Graphic& mrGraphic;
 
-    bool rotateBitmapOnly (sal_uInt16 aRotation);
-    void rotateJPEG       (sal_uInt16 aRotation);
-    bool rotateGeneric    (sal_uInt16 aRotation, const OUString& aType);
+    bool rotateBitmapOnly(sal_uInt16 aRotation);
+    void rotateJPEG(sal_uInt16 aRotation);
+    bool rotateGeneric(sal_uInt16 aRotation, const OUString& aType);
 
 public:
     GraphicNativeTransform(Graphic& rGraphic);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index ddfe3e914923..e24cb7d4b500 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -7320,8 +7320,6 @@ include/vcl/BitmapTools.hxx
 include/vcl/ColorMask.hxx
 include/vcl/EnumContext.hxx
 include/vcl/FilterConfigItem.hxx
-include/vcl/GraphicNativeMetadata.hxx
-include/vcl/GraphicNativeTransform.hxx
 include/vcl/GraphicObject.hxx
 include/vcl/IContext.hxx
 include/vcl/IDialogRenderable.hxx
@@ -17152,8 +17150,6 @@ vcl/source/edit/xtextedt.cxx
 vcl/source/filter/FilterConfigCache.cxx
 vcl/source/filter/FilterConfigCache.hxx
 vcl/source/filter/FilterConfigItem.cxx
-vcl/source/filter/GraphicNativeMetadata.cxx
-vcl/source/filter/GraphicNativeTransform.cxx
 vcl/source/filter/graphicfilter.cxx
 vcl/source/filter/graphicfilter2.cxx
 vcl/source/filter/graphicfilter_internal.hxx
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index e42669d3c4aa..132a51a52391 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -25,18 +25,17 @@
 #include "jpeg/Exif.hxx"
 #include <memory>
 
-GraphicNativeMetadata::GraphicNativeMetadata() :
-    mRotation(0)
-{}
-
-GraphicNativeMetadata::~GraphicNativeMetadata()
-{}
+GraphicNativeMetadata::GraphicNativeMetadata()
+    : mRotation(0)
+{
+}
 
+GraphicNativeMetadata::~GraphicNativeMetadata() {}
 
-bool GraphicNativeMetadata::read(Graphic const & rGraphic)
+bool GraphicNativeMetadata::read(Graphic const& rGraphic)
 {
     GfxLink aLink = rGraphic.GetGfxLink();
-    if ( aLink.GetType() != GfxLinkType::NativeJpg )
+    if (aLink.GetType() != GfxLinkType::NativeJpg)
         return false;
 
     sal_uInt32 aDataSize = aLink.GetDataSize();
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index ba6e6a194f63..8083dd4c2e77 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -30,12 +30,12 @@
 
 using namespace ::exif;
 
-GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic) :
-    mrGraphic(rGraphic)
-{}
+GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic)
+    : mrGraphic(rGraphic)
+{
+}
 
-GraphicNativeTransform::~GraphicNativeTransform()
-{}
+GraphicNativeTransform::~GraphicNativeTransform() {}
 
 void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
 {
@@ -52,19 +52,19 @@ void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
     }
 
     GfxLink aLink = mrGraphic.GetGfxLink();
-    if ( aLink.GetType() == GfxLinkType::NativeJpg )
+    if (aLink.GetType() == GfxLinkType::NativeJpg)
     {
         rotateJPEG(aRotation);
     }
-    else if ( aLink.GetType() == GfxLinkType::NativePng )
+    else if (aLink.GetType() == GfxLinkType::NativePng)
     {
         rotateGeneric(aRotation, "png");
     }
-    else if ( aLink.GetType() == GfxLinkType::NativeGif )
+    else if (aLink.GetType() == GfxLinkType::NativeGif)
     {
         rotateGeneric(aRotation, "gif");
     }
-    else if ( aLink.GetType() == GfxLinkType::NONE )
+    else if (aLink.GetType() == GfxLinkType::NONE)
     {
         rotateBitmapOnly(aRotation);
     }
@@ -96,24 +96,24 @@ bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString&
 
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
-    css::uno::Sequence< css::beans::PropertyValue > aFilterData( 3 );
-    aFilterData[ 0 ].Name = "Interlaced";
-    aFilterData[ 0 ].Value <<= sal_Int32(0);
-    aFilterData[ 1 ].Name = "Compression";
-    aFilterData[ 1 ].Value <<= sal_Int32(9);
-    aFilterData[ 2 ].Name = "Quality";
-    aFilterData[ 2 ].Value <<= sal_Int32(90);
+    css::uno::Sequence<css::beans::PropertyValue> aFilterData(3);
+    aFilterData[0].Name = "Interlaced";
+    aFilterData[0].Value <<= sal_Int32(0);
+    aFilterData[1].Name = "Compression";
+    aFilterData[1].Value <<= sal_Int32(9);
+    aFilterData[2].Name = "Quality";
+    aFilterData[2].Value <<= sal_Int32(90);
 
-    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( aType );
+    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(aType);
 
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
     aBitmap.Rotate(aRotation, COL_BLACK);
-    rFilter.ExportGraphic( aBitmap, "none", aStream, nFilterFormat, &aFilterData );
+    rFilter.ExportGraphic(aBitmap, "none", aStream, nFilterFormat, &aFilterData);
 
-    aStream.Seek( STREAM_SEEK_TO_BEGIN );
+    aStream.Seek(STREAM_SEEK_TO_BEGIN);
 
     Graphic aGraphic;
-    rFilter.ImportGraphic( aGraphic, "import", aStream );
+    rFilter.ImportGraphic(aGraphic, "import", aStream);
 
     mrGraphic = aGraphic;
     return true;
@@ -123,8 +123,7 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 {
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
 
-    if (aBitmap.GetSizePixel().Width()  % 16 != 0 ||
-        aBitmap.GetSizePixel().Height() % 16 != 0 )
+    if (aBitmap.GetSizePixel().Width() % 16 != 0 || aBitmap.GetSizePixel().Height() % 16 != 0)
     {
         rotateGeneric(aRotation, "png");
     }
@@ -134,12 +133,12 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 
         SvMemoryStream aSourceStream;
         aSourceStream.WriteBytes(aLink.GetData(), aLink.GetDataSize());
-        aSourceStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aSourceStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Orientation aOrientation = TOP_LEFT;
 
         Exif exif;
-        if ( exif.read(aSourceStream) )
+        if (exif.read(aSourceStream))
         {
             aOrientation = exif.getOrientation();
         }
@@ -149,20 +148,20 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
         transform.setRotate(aRotation);
         transform.perform();
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         // Reset orientation in exif if needed
-        if ( exif.hasExif() && aOrientation != TOP_LEFT)
+        if (exif.hasExif() && aOrientation != TOP_LEFT)
         {
             exif.setOrientation(TOP_LEFT);
             exif.write(aTargetStream);
         }
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Graphic aGraphic;
         GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
-        rFilter.ImportGraphic( aGraphic, "import", aTargetStream );
+        rFilter.ImportGraphic(aGraphic, "import", aTargetStream);
         mrGraphic = aGraphic;
     }
 }


More information about the Libreoffice-commits mailing list