[PATCH] Complete Easy Hack: Remove obsolete BmpColorMode enum

Chris Carpenter (mordocai) mordocai at gmail.com
Tue Feb 1 21:39:29 PST 2011


---
 vcl/inc/vcl/bitmap.hxx      |   10 +--------
 vcl/inc/vcl/bitmapex.hxx    |    2 +-
 vcl/inc/vcl/image.h         |    2 +-
 vcl/inc/vcl/outdev.hxx      |    2 -
 vcl/source/gdi/bitmap.cxx   |   32 ------------------------------
 vcl/source/gdi/bitmapex.cxx |   30 ----------------------------
 vcl/source/gdi/image.cxx    |   45 -------------------------------------------
 vcl/source/gdi/impimage.cxx |   18 -----------------
 8 files changed, 3 insertions(+), 138 deletions(-)

diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 58195e9..dba8ba0 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -145,14 +145,6 @@ enum BmpFilter
 
 // ------------------------------------------------------------------------
 
-enum BmpColorMode
-{
-    BMP_COLOR_NORMAL = 0,
-    BMP_COLOR_HIGHCONTRAST = 1,
-    BMP_COLOR_MONOCHROME_BLACK = 2,
-    BMP_COLOR_MONOCHROME_WHITE = 3
-};
-
 // --------------------
 // - FilterParameters -
 // --------------------
@@ -362,7 +354,7 @@ public:
     ULONG					GetChecksum() const;
 
     Bitmap                  CreateDisplayBitmap( OutputDevice* pDisplay );
-    Bitmap                  GetColorTransformedBitmap( BmpColorMode eColorMode ) const;
+    Bitmap                  GetColorTransformedBitmap() const;
 
     static const BitmapPalette& GetGreyPalette( int nEntries );
 
diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx
index 79cee21..4227b66 100644
--- a/vcl/inc/vcl/bitmapex.hxx
+++ b/vcl/inc/vcl/bitmapex.hxx
@@ -105,7 +105,7 @@ public:
     Bitmap				GetBitmap( const Color* pTransReplaceColor = NULL ) const;
     Bitmap				GetMask() const;
 
-    BitmapEx            GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const;
+    BitmapEx            GetColorTransformedBitmapEx() const;
 
     BOOL				IsAlpha() const;
     AlphaMask			GetAlpha() const;
diff --git a/vcl/inc/vcl/image.h b/vcl/inc/vcl/image.h
index 0234d57..a7a9a22 100644
--- a/vcl/inc/vcl/image.h
+++ b/vcl/inc/vcl/image.h
@@ -54,7 +54,7 @@ public:
     void		Replace( USHORT nPos, const BitmapEx& rBmpEx );
 
     void        ReplaceColors( const Color* pSrcColors, const Color* pDstColors, ULONG nColorCount );
-    void		ColorTransform( BmpColorMode eColorMode );
+    void		ColorTransform();
     void        	Invert();
 
     BitmapEx	GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const;
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index e975de6..cef22b9 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -198,8 +198,6 @@ struct KerningPair
 #define IMAGE_DRAW_DEACTIVE             ((USHORT)0x0004)
 #define IMAGE_DRAW_COLORTRANSFORM      	((USHORT)0x0008)
 #define IMAGE_DRAW_SEMITRANSPARENT      ((USHORT)0x0010)
-#define IMAGE_DRAW_MONOCHROME_BLACK  	((USHORT)0x0020)
-#define IMAGE_DRAW_MONOCHROME_WHITE  	((USHORT)0x0040)
 #define IMAGE_DRAW_3DLOOK               0
 #define IMAGE_DRAW_BTNLOOK              0
 
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 8fa4ab6..543d948 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1739,38 +1739,6 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay )
 
 // ------------------------------------------------------------------
 
-Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const
-{
-    Bitmap  aRet;
-    
-    if( BMP_COLOR_HIGHCONTRAST == eColorMode )
-    {
-        Color*  pSrcColors = NULL;
-        Color*  pDstColors = NULL;
-        ULONG   nColorCount = 0;
-        
-        aRet = *this;
-
-        Image::GetColorTransformArrays( (ImageColorTransform) eColorMode, pSrcColors, pDstColors, nColorCount );
-
-        if( nColorCount && pSrcColors && pDstColors )
-               aRet.Replace( pSrcColors, pDstColors, nColorCount ); 
-
-        delete[] pSrcColors;
-        delete[] pDstColors;
-    }
-    else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode ||
-             BMP_COLOR_MONOCHROME_WHITE == eColorMode )
-    {
-        aRet = *this;
-        aRet.MakeMono( BMP_COLOR_MONOCHROME_THRESHOLD );
-    }
-            
-    return aRet;
-}
-
-// ------------------------------------------------------------------
-
 BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
 {
     BitmapReadAccess*	pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index ccd2672..fc44917 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -298,36 +298,6 @@ Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const
 
 // ------------------------------------------------------------------
 
-BitmapEx BitmapEx::GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const
-{
-    BitmapEx aRet;
-    
-    if( BMP_COLOR_HIGHCONTRAST == eColorMode )
-    {
-        aRet = *this;
-        aRet.aBitmap = aBitmap.GetColorTransformedBitmap( eColorMode );
-    }
-    else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode ||
-             BMP_COLOR_MONOCHROME_WHITE == eColorMode )
-    {
-        aRet = *this;
-        aRet.aBitmap = aRet.aBitmap.GetColorTransformedBitmap( eColorMode );
-        
-        if( !aRet.aMask.IsEmpty() )
-        {
-            aRet.aMask.CombineSimple( aRet.aBitmap, BMP_COMBINE_OR );
-            aRet.aBitmap.Erase( ( BMP_COLOR_MONOCHROME_BLACK == eColorMode ) ? COL_BLACK : COL_WHITE );
-
-            DBG_ASSERT( aRet.aBitmap.GetSizePixel() == aRet.aMask.GetSizePixel(),
-                        "BitmapEx::GetColorTransformedBitmapEx(): size mismatch for bitmap and alpha mask." );
-        }
-    }
-
-    return aRet;
-}
-
-// ------------------------------------------------------------------
-
 Bitmap BitmapEx::GetMask() const
 {
     Bitmap aRet( aMask );
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
index 5dff935..73dacff 100644
--- a/vcl/source/gdi/image.cxx
+++ b/vcl/source/gdi/image.cxx
@@ -275,51 +275,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const
 
 // -----------------------------------------------------------------------
 
-Image Image::GetColorTransformedImage( ImageColorTransform eColorTransform ) const
-{
-    DBG_CHKTHIS( Image, NULL );
-
-    Image aRet;
-
-    if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform )
-    {
-        BitmapEx aBmpEx( GetBitmapEx() );
-
-        if( !aBmpEx.IsEmpty() )
-        {
-            Color*  pSrcColors = NULL;
-            Color*  pDstColors = NULL;
-            ULONG   nColorCount = 0;
-
-            Image::GetColorTransformArrays( eColorTransform, pSrcColors, pDstColors, nColorCount );
-
-            if( nColorCount && pSrcColors && pDstColors )
-            {
-                aBmpEx.Replace( pSrcColors, pDstColors, nColorCount ); 
-                aRet = Image( aBmpEx );
-            }
-
-            delete[] pSrcColors;
-            delete[] pDstColors;
-        }
-    }
-    else if( IMAGECOLORTRANSFORM_MONOCHROME_BLACK == eColorTransform ||
-             IMAGECOLORTRANSFORM_MONOCHROME_WHITE == eColorTransform  )
-    {
-        BitmapEx aBmpEx( GetBitmapEx() );
-
-        if( !aBmpEx.IsEmpty() )
-            aRet = Image( aBmpEx.GetColorTransformedBitmapEx( ( BmpColorMode )( eColorTransform ) ) );
-    }
-
-    if( !aRet )
-        aRet = *this;
-
-    return aRet;
-}
-
-// -----------------------------------------------------------------------
-
 void Image::Invert()
 {
     BitmapEx aInvertedBmp( GetBitmapEx() );
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
index ad91356..7775d01 100644
--- a/vcl/source/gdi/impimage.cxx
+++ b/vcl/source/gdi/impimage.cxx
@@ -347,15 +347,6 @@ void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColo
 
 // -----------------------------------------------------------------------
 
-void ImplImageBmp::ColorTransform( BmpColorMode eColorMode )
-{
-    maBmpEx = maBmpEx.GetColorTransformedBitmapEx( eColorMode );
-    delete mpDisplayBmp;
-    mpDisplayBmp = NULL;
-}
-
-// -----------------------------------------------------------------------
-
 BitmapEx ImplImageBmp::GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const
 {
     const Bitmap	aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ),  maBmpEx.GetBitmap().GetBitCount() );
@@ -405,7 +396,6 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev,
         else
         {
             if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM |
-                           IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE |
                            IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) )
             {
                 BitmapEx        aTmpBmpEx;
@@ -418,14 +408,6 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev,
 
                 aTmpBmpEx.Crop( aCropRect );
 
-                if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE ) )
-                {
-                    const BmpColorMode eMode = ( nStyle & IMAGE_DRAW_COLORTRANSFORM ) ? BMP_COLOR_HIGHCONTRAST :
-                                                ( ( nStyle & IMAGE_DRAW_MONOCHROME_BLACK ) ? BMP_COLOR_MONOCHROME_BLACK : BMP_COLOR_MONOCHROME_WHITE );
-
-                    aTmpBmpEx = aTmpBmpEx.GetColorTransformedBitmapEx( eMode );
-                }
-
                 Bitmap aTmpBmp( aTmpBmpEx.GetBitmap() );
 
                 if( nStyle & ( IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE ) )
-- 
1.7.2.3


--------------000405070809050505070604
Content-Type: text/x-patch;
 name="0001-Complete-Easy-Hack-Remove-obsolete-BmpColo.libs-core.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-Complete-Easy-Hack-Remove-obsolete-BmpColo.libs-core.pa";
 filename*1="tch"



More information about the LibreOffice mailing list