[Libreoffice-commits] core.git: compilerplugins/clang include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 27 09:15:58 UTC 2018


 compilerplugins/clang/unusedenumconstants.readonly.results |    4 
 include/vcl/bitmap.hxx                                     |    8 
 vcl/source/gdi/bitmap3.cxx                                 |  174 -------------
 3 files changed, 2 insertions(+), 184 deletions(-)

New commits:
commit 11fc3b52db6e46d0879b163da59df14268c1fe13
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Nov 26 10:15:56 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 27 10:15:31 2018 +0100

    remove unused BmpDitherFlags enum values
    
    Change-Id: I09a0eb661b66da78d8b3809124930bc761960712
    Reviewed-on: https://gerrit.libreoffice.org/64064
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results b/compilerplugins/clang/unusedenumconstants.readonly.results
index 0bd6ffd899c7..6a2e090b7e57 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -590,10 +590,6 @@ include/unotools/fontdefs.hxx:71
     enum DefaultFontType LATIN_FIXED
 include/unotools/fontdefs.hxx:81
     enum DefaultFontType CTL_DISPLAY
-include/vcl/bitmap.hxx:65
-    enum BmpDitherFlags Matrix
-include/vcl/bitmap.hxx:67
-    enum BmpDitherFlags Floyd16
 include/vcl/errinf.hxx:84
     enum DialogMask ButtonsYesNo
 include/vcl/errinf.hxx:87
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index c23367c34c9a..b67850196b7a 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -62,13 +62,11 @@ enum class BmpScaleFlag
 enum class BmpDitherFlags
 {
     NONE             = 0x0000,
-    Matrix           = 0x0001,
-    Floyd            = 0x0002,
-    Floyd16          = 0x0004,
+    Floyd            = 0x0001,
 };
 namespace o3tl
 {
-    template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x07> {};
+    template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x01> {};
 }
 
 #define BMP_COL_TRANS               Color( 252, 3, 251 )
@@ -535,9 +533,7 @@ public:
     SAL_DLLPRIVATE void     ImplSetSalBitmap( const std::shared_ptr<SalBitmap>& xImpBmp );
 
     SAL_DLLPRIVATE bool     ImplMakeGreyscales( sal_uInt16 nGreyscales );
-    SAL_DLLPRIVATE bool     ImplDitherMatrix();
     SAL_DLLPRIVATE bool     ImplDitherFloyd();
-    SAL_DLLPRIVATE bool     ImplDitherFloyd16();
 
 public:
 
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 15f2352e96ef..0d1f8eced642 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -895,84 +895,8 @@ bool Bitmap::Dither( BmpDitherFlags nDitherFlags )
 
     if( aSizePix.Width() == 1 || aSizePix.Height() == 1 )
         bRet = true;
-    else if( nDitherFlags & BmpDitherFlags::Matrix )
-        bRet = ImplDitherMatrix();
     else if( nDitherFlags & BmpDitherFlags::Floyd )
         bRet = ImplDitherFloyd();
-    else if( ( nDitherFlags & BmpDitherFlags::Floyd16 ) && ( GetBitCount() == 24 ) )
-        bRet = ImplDitherFloyd16();
-
-    return bRet;
-}
-
-bool Bitmap::ImplDitherMatrix()
-{
-    ScopedReadAccess pReadAcc(*this);
-    Bitmap aNewBmp( GetSizePixel(), 8 );
-    BitmapScopedWriteAccess pWriteAcc(aNewBmp);
-    bool bRet = false;
-
-    if( pReadAcc && pWriteAcc )
-    {
-        const sal_uLong nWidth = pReadAcc->Width();
-        const sal_uLong nHeight = pReadAcc->Height();
-        BitmapColor aIndex( sal_uInt8(0) );
-
-        if( pReadAcc->HasPalette() )
-        {
-            for( sal_uLong nY = 0; nY < nHeight; nY++ )
-            {
-                Scanline pScanline = pWriteAcc->GetScanline(nY);
-                Scanline pScanlineRead = pReadAcc->GetScanline(nY);
-                for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
-                {
-                    const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nX ) ) );
-                    const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
-                    const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
-                    const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
-                    const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
-
-                    aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
-                    pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
-                }
-            }
-        }
-        else
-        {
-            for( sal_uLong nY = 0; nY < nHeight; nY++ )
-            {
-                Scanline pScanline = pWriteAcc->GetScanline(nY);
-                Scanline pScanlineRead = pReadAcc->GetScanline(nY);
-                for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
-                {
-                    const BitmapColor aCol( pReadAcc->GetPixelFromData( pScanlineRead, nX ) );
-                    const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
-                    const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
-                    const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
-                    const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
-
-                    aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
-                    pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
-                }
-            }
-        }
-
-        bRet = true;
-    }
-
-    pReadAcc.reset();
-    pWriteAcc.reset();
-
-    if( bRet )
-    {
-        const MapMode aMap( maPrefMapMode );
-        const Size aSize( maPrefSize );
-
-        *this = aNewBmp;
-
-        maPrefMapMode = aMap;
-        maPrefSize = aSize;
-    }
 
     return bRet;
 }
@@ -1118,104 +1042,6 @@ bool Bitmap::ImplDitherFloyd()
     return bRet;
 }
 
-bool Bitmap::ImplDitherFloyd16()
-{
-    ScopedReadAccess pReadAcc(*this);
-    Bitmap aNewBmp( GetSizePixel(), 24 );
-    BitmapScopedWriteAccess pWriteAcc(aNewBmp);
-    bool bRet = false;
-
-    if( pReadAcc && pWriteAcc )
-    {
-        const long nWidth = pWriteAcc->Width();
-        const long nWidth1 = nWidth - 1;
-        const long nHeight = pWriteAcc->Height();
-        BitmapColor aColor;
-        BitmapColor aBestCol;
-        ImpErrorQuad aErrQuad;
-        std::unique_ptr<ImpErrorQuad[]> pErrQuad1(new ImpErrorQuad[ nWidth ]);
-        std::unique_ptr<ImpErrorQuad[]> pErrQuad2(new ImpErrorQuad[ nWidth ]);
-        ImpErrorQuad* pQLine1 = pErrQuad1.get();
-        ImpErrorQuad* pQLine2 = nullptr;
-        long nYTmp = 0;
-        bool bQ1 = true;
-
-        for( long nY = 0; nY < std::min( nHeight, 2L ); nY++, nYTmp++ )
-        {
-            pQLine2 = !nY ? pErrQuad1.get() : pErrQuad2.get();
-            Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
-            for( long nX = 0; nX < nWidth; nX++ )
-                pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
-        }
-
-        assert(pQLine2 || nHeight == 0);
-
-        for( long nY = 0; nY < nHeight; nY++, nYTmp++ )
-        {
-            // First RowPixel
-            aBestCol = pQLine1[ 0 ].ImplGetColor();
-            aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
-            aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
-            aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
-            Scanline pScanline = pWriteAcc->GetScanline(nY);
-            pWriteAcc->SetPixelOnData( pScanline, 0, aBestCol );
-
-            long nX;
-            for( nX = 1; nX < nWidth1; nX++ )
-            {
-                aColor = pQLine1[ nX ].ImplGetColor();
-                aBestCol.SetRed( ( aColor.GetRed() & 248 ) | 7 );
-                aBestCol.SetGreen( ( aColor.GetGreen() & 248 ) | 7 );
-                aBestCol.SetBlue( ( aColor.GetBlue() & 248 ) | 7 );
-                aErrQuad = ( ImpErrorQuad( aColor ) -= aBestCol );
-                pQLine1[ ++nX ].ImplAddColorError7( aErrQuad );
-                pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
-                pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
-                pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
-                pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
-            }
-
-            // Last RowPixel
-            aBestCol = pQLine1[ nWidth1 ].ImplGetColor();
-            aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
-            aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
-            aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
-            pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
-
-            // Refill/copy row buffer
-            pQLine1 = pQLine2;
-            bQ1 = !bQ1;
-            pQLine2 = bQ1 ? pErrQuad2.get() : pErrQuad1.get();
-
-            if( nYTmp < nHeight )
-            {
-                Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
-                for( nX = 0; nX < nWidth; nX++ )
-                    pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
-            }
-        }
-
-        bRet = true;
-    }
-
-    pReadAcc.reset();
-    pWriteAcc.reset();
-
-    if( bRet )
-    {
-        const MapMode aMap( maPrefMapMode );
-        const Size aSize( maPrefSize );
-
-        *this = aNewBmp;
-
-        maPrefMapMode = aMap;
-        maPrefSize = aSize;
-    }
-
-    return bRet;
-}
-
-
 void Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, const Link<long,void>* pProgress )
 {
     ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, pProgress );


More information about the Libreoffice-commits mailing list