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

Joseph Powers jpowers at kemper.freedesktop.org
Sat Jul 23 08:07:15 PDT 2011


 vcl/inc/vcl/alpha.hxx    |  137 +++++++++++++++++++++++++++++++----------------
 vcl/source/gdi/alpha.cxx |  123 ------------------------------------------
 2 files changed, 93 insertions(+), 167 deletions(-)

New commits:
commit e0819c362a6b47b77da9806bfe0d9d3322f49951
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Jul 23 08:04:17 2011 -0700

    unusedcode.easy: AlphaMask

diff --git a/vcl/inc/vcl/alpha.hxx b/vcl/inc/vcl/alpha.hxx
index e23f1fb..6e51a8a 100644
--- a/vcl/inc/vcl/alpha.hxx
+++ b/vcl/inc/vcl/alpha.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -58,57 +58,102 @@ public:
                             AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL );
                             ~AlphaMask();
 
-    AlphaMask&				operator=( const Bitmap& rBitmap );
-    AlphaMask&				operator=( const AlphaMask& rAlphaMask ) { return (AlphaMask&) Bitmap::operator=( rAlphaMask ); }
-    sal_Bool					operator!() const { return Bitmap::operator!(); }
-    sal_Bool					operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); }
-    sal_Bool					operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); }
-
-    const MapMode&			GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); }
-    void					SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); }
-
-    const Size&				GetPrefSize() const { return Bitmap::GetPrefSize(); }
-    void					SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); }
-
-    Size					GetSizePixel() const { return Bitmap::GetSizePixel(); }
-    void					SetSizePixel( const Size& rNewSize ) { Bitmap::SetSizePixel( rNewSize ); }
-
-    sal_uLong					GetSizeBytes() const { return Bitmap::GetSizeBytes(); }
-    sal_uLong					GetChecksum() const { return Bitmap::GetChecksum(); }
-
-    Bitmap					GetBitmap() const;
-
-public:
-
-    sal_Bool                    Crop( const Rectangle& rRectPixel );
-    sal_Bool                    Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency = NULL );
-    sal_Bool                    CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc = NULL );
-    sal_Bool                    Erase( sal_uInt8 cTransparency );
-    sal_Bool                    Invert();
-    sal_Bool                    Mirror( sal_uLong nMirrorFlags );
-    sal_Bool                    Scale( const Size& rNewSize, sal_uLong nScaleFlag = BMP_SCALE_FAST );
-    sal_Bool                    Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag = BMP_SCALE_FAST );
-    sal_Bool                    Rotate( long nAngle10, sal_uInt8 cFillTransparency );
-    sal_Bool                    Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
-    sal_Bool                    Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL );
-    sal_Bool                    Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies,
-                                     sal_uLong nColorCount, sal_uLong* pTols = NULL );
-
-public:
-
-    BitmapReadAccess*		AcquireReadAccess() { return Bitmap::AcquireReadAccess(); }
-    BitmapWriteAccess*		AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); }
-    void					ReleaseAccess( BitmapReadAccess* pAccess );
+    AlphaMask&              operator=( const Bitmap& rBitmap );
+    AlphaMask&              operator=( const AlphaMask& rAlphaMask )
+                            {
+                                return (AlphaMask&) Bitmap::operator=( rAlphaMask );
+                            }
+    sal_Bool                operator!() const
+                            {
+                                return Bitmap::operator!();
+                            }
+    sal_Bool                operator==( const AlphaMask& rAlphaMask ) const
+                            {
+                                return Bitmap::operator==( rAlphaMask );
+                            }
+    sal_Bool                operator!=( const AlphaMask& rAlphaMask ) const
+                            {
+                                return Bitmap::operator!=( rAlphaMask );
+                            }
+
+    const MapMode&          GetPrefMapMode() const
+                            {
+                                return Bitmap::GetPrefMapMode();
+                            }
+    void                    SetPrefMapMode( const MapMode& rMapMode )
+                            {
+                                Bitmap::SetPrefMapMode( rMapMode );
+                            }
+
+    const Size&             GetPrefSize() const
+                            {
+                                return Bitmap::GetPrefSize();
+                            }
+    void                    SetPrefSize( const Size& rSize )
+                            {
+                                Bitmap::SetPrefSize( rSize );
+                            }
+
+    Size                    GetSizePixel() const
+                            {
+                                return Bitmap::GetSizePixel();
+                            }
+    void                    SetSizePixel( const Size& rNewSize )
+                            {
+                                Bitmap::SetSizePixel( rNewSize );
+                            }
+
+    sal_uLong               GetSizeBytes() const
+                            {
+                                return Bitmap::GetSizeBytes();
+                            }
+    sal_uLong               GetChecksum() const
+                            {
+                                return Bitmap::GetChecksum();
+                            }
+
+    Bitmap                  GetBitmap() const;
+
+    sal_Bool                CopyPixel(
+                                const Rectangle& rRectDst,
+                                const Rectangle& rRectSrc,
+                                const AlphaMask* pAlphaSrc = NULL
+                            );
+    sal_Bool                Erase( sal_uInt8 cTransparency );
+    sal_Bool                Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
+    sal_Bool                Replace(
+                                sal_uInt8 cSearchTransparency,
+                                sal_uInt8 cReplaceTransparency,
+                                sal_uLong nTol = 0UL
+                            );
+
+    BitmapReadAccess*       AcquireReadAccess()
+                            {
+                                return Bitmap::AcquireReadAccess();
+                            }
+    BitmapWriteAccess*      AcquireWriteAccess()
+                            {
+                                return Bitmap::AcquireWriteAccess();
+                            }
+    void                    ReleaseAccess( BitmapReadAccess* pAccess );
 
     typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess >
         ScopedReadAccess;
     typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
         ScopedWriteAccess;
 
-public:
-
-    sal_Bool					Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); }
-    sal_Bool					Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const { return Bitmap::Write( rOStm, bCompressed, bFileHeader ); }
+    sal_Bool                Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True )
+                            {
+                                return Bitmap::Read( rIStm, bFileHeader );
+                            }
+    sal_Bool                Write(
+                                SvStream& rOStm,
+                                sal_Bool bCompressed = sal_True,
+                                sal_Bool bFileHeader = sal_True
+                            ) const
+                            {
+                                return Bitmap::Write( rOStm, bCompressed, bFileHeader );
+                            }
 
     friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
     friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
index b2da04d..6fc9cc8 100644
--- a/vcl/source/gdi/alpha.cxx
+++ b/vcl/source/gdi/alpha.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -108,26 +108,7 @@ Bitmap AlphaMask::GetBitmap() const
 
 // -----------------------------------------------------------------------------
 
-sal_Bool AlphaMask::Crop( const Rectangle& rRectPixel )
-{
-    return Bitmap::Crop( rRectPixel );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency )
-{
-    Color aColor;
-
-    if( pInitTransparency )
-        aColor = Color( *pInitTransparency, *pInitTransparency, *pInitTransparency );
-
-    return Bitmap::Expand( nDX, nDY, pInitTransparency ? &aColor : NULL );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, 
+sal_Bool AlphaMask::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc,
                            const AlphaMask* pAlphaSrc )
 {
     // Note: this code is copied from Bitmap::CopyPixel but avoids any palette lookups
@@ -245,79 +226,6 @@ sal_Bool AlphaMask::Erase( sal_uInt8 cTransparency )
 
 // -----------------------------------------------------------------------------
 
-sal_Bool AlphaMask::Invert()
-{
-    BitmapWriteAccess*	pAcc = AcquireWriteAccess();
-    sal_Bool				bRet = sal_False;
-
-    if( pAcc && pAcc->GetBitCount() == 8 )
-    {
-        BitmapColor	aCol( 0 );
-        const long	nWidth = pAcc->Width(),	nHeight = pAcc->Height();
-        sal_uInt8*		pMap = new sal_uInt8[ 256 ];
-
-        for( long i = 0; i < 256; i++ )
-            pMap[ i ] = ~(sal_uInt8) i;
-
-        for( long nY = 0L; nY < nHeight; nY++ )
-        {
-            for( long nX = 0L; nX < nWidth; nX++ )
-            {
-                aCol.SetIndex( pMap[ pAcc->GetPixel( nY, nX ).GetIndex() ] );
-                pAcc->SetPixel( nY, nX, aCol );
-            }
-        }
-
-        delete[] pMap;
-        bRet = sal_True;
-    }
-
-    if( pAcc )
-        ReleaseAccess( pAcc );
-
-    return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::Mirror( sal_uLong nMirrorFlags )
-{
-    return Bitmap::Mirror( nMirrorFlags );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::Scale( const Size& rNewSize, sal_uLong nScaleFlag )
-{
-    sal_Bool bRet = Bitmap::Scale( rNewSize, nScaleFlag );
-
-    if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) )
-        Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
-
-    return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag )
-{
-    sal_Bool bRet = Bitmap::Scale( rScaleX, rScaleY, nScaleFlag );
-
-    if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) )
-        Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
-
-    return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool AlphaMask::Rotate( long nAngle10, sal_uInt8 cFillTransparency )
-{
-    return Bitmap::Rotate( nAngle10, Color( cFillTransparency, cFillTransparency, cFillTransparency ) );
-}
-
-// -----------------------------------------------------------------------------
-
 sal_Bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency )
 {
     BitmapReadAccess*	pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
@@ -398,33 +306,6 @@ nTol
 
 // -----------------------------------------------------------------------------
 
-sal_Bool AlphaMask::Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies,
-                         sal_uLong nColorCount, sal_uLong* pTols )
-{
-    Color*	pSearchColors = new Color[ nColorCount ];
-    Color*	pReplaceColors = new Color[ nColorCount ];
-    sal_Bool	bRet;
-
-    for( sal_uLong i = 0; i < nColorCount; i++ )
-    {
-        const sal_uInt8 cSearchTransparency = pSearchTransparencies[ i ];
-        const sal_uInt8 cReplaceTransparency = pReplaceTransparencies[ i ];
-
-        pSearchColors[ i ] = Color( cSearchTransparency, cSearchTransparency, cSearchTransparency );
-        pReplaceColors[ i ] = Color( cReplaceTransparency, cReplaceTransparency, cReplaceTransparency );
-    }
-
-    bRet = Bitmap::Replace( pSearchColors, pReplaceColors, nColorCount, pTols ) &&
-           Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
-
-    delete[] pSearchColors;
-    delete[] pReplaceColors;
-
-    return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
 void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess )
 {
     if( pAccess )


More information about the Libreoffice-commits mailing list