summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-07-21 15:32:50 +0200
committerJens-Heiner Rechtien <hr@openoffice.org>2010-07-21 15:32:50 +0200
commita6fb87b1093328f9cf6eeb2a4d829c90cc0b4fd6 (patch)
tree12f32db0e506c5c09ef39d65f343efbb5d2a6113 /vcl
parenta1e6cecc361c2f6e26ee6738231184022f6b18dd (diff)
parent722441b99292269a42db1c0de6bce9351e8de933 (diff)
CWS-TOOLING: integrate CWS unoawt2
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/imgcons.hxx105
-rw-r--r--vcl/prj/d.lst3
-rw-r--r--vcl/source/gdi/imgcons.cxx574
-rw-r--r--vcl/source/gdi/makefile.mk1
-rw-r--r--vcl/source/gdi/outdev2.cxx71
5 files changed, 29 insertions, 725 deletions
diff --git a/vcl/inc/vcl/imgcons.hxx b/vcl/inc/vcl/imgcons.hxx
deleted file mode 100644
index 2f582fec15c3..000000000000
--- a/vcl/inc/vcl/imgcons.hxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _IMGCONS_HXX
-#define _IMGCONS_HXX
-
-#include <vcl/dllapi.h>
-
-#include <vcl/bitmap.hxx>
-
-// -----------------
-// - ImageConsumer -
-// -----------------
-
-class ImageProducer;
-class ImplColorMapper;
-class BitmapEx;
-class Image;
-
-#define IMAGEERROR 1
-#define SINGLEFRAMEDONE 2
-#define STATICIMAGEDONE 3
-#define IMAGEABORTED 4
-
-class VCL_DLLPUBLIC ImageConsumer
-{
-private:
-
- Bitmap maBitmap;
- Bitmap maMask;
- Rectangle maChangedRect;
- Size maSize;
- ImplColorMapper* mpMapper;
- Color* mpPal;
- Link maChgLink;
- Link maDoneLink;
- sal_uInt32 mnFormat;
- sal_uInt32 mnStatus;
- BOOL mbTrans;
-
-protected:
-
- virtual void DataChanged();
-
-public:
-
- ImageConsumer();
- virtual ~ImageConsumer();
-
- BOOL GetData( BitmapEx& rBmpEx ) const;
- BOOL GetData( Image& rImage ) const;
- const Rectangle& GetChangedRect() const { return maChangedRect; }
- sal_uInt32 GetStatus() const;
-
- void SetDataChangedLink( const Link& rLink ) { maChgLink = rLink; }
- const Link& GetDataChangedLink() const { return maChgLink; }
-
- void SetDoneLink( const Link& rLink ) { maDoneLink = rLink; }
- const Link& GetDoneLink() const { return maDoneLink; }
-
-public:
-
- virtual void Init( sal_uInt32 nWidth, sal_uInt32 nHeight );
-
- virtual void SetColorModel( USHORT nBitCount,
- sal_uInt32 nPalEntries, const sal_uInt32* pRGBAPal,
- sal_uInt32 nRMask, sal_uInt32 nGMask, sal_uInt32 nBMask, sal_uInt32 nAMask );
-
- virtual void SetPixelsByBytes( sal_uInt32 nConsX, sal_uInt32 nConsY,
- sal_uInt32 nConsWidth, sal_uInt32 nConsHeight,
- const BYTE* pProducerData, sal_uInt32 nOffset, sal_uInt32 nScanSize );
-
- virtual void SetPixelsByLongs( sal_uInt32 nConsX, sal_uInt32 nConsY,
- sal_uInt32 nConsWidth, sal_uInt32 nConsHeight,
- const sal_uInt32* pProducerData, sal_uInt32 nOffset, sal_uInt32 nScanSize );
-
- virtual void Completed( sal_uInt32 nStatus );
-// virtual void Completed( sal_uInt32 nStatus, ImageProducer& rProducer );
-};
-
-#endif // _IMGCONS_HXX
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
index 8345b155ce58..38c025b5a5af 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -56,7 +56,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\help.hxx %_DEST%\inc%_EXT%\vcl\help.hxx
..\inc\vcl\image.hxx %_DEST%\inc%_EXT%\vcl\image.hxx
..\inc\vcl\imagerepository.hxx %_DEST%\inc%_EXT%\vcl\imagerepository.hxx
-..\inc\vcl\imgcons.hxx %_DEST%\inc%_EXT%\vcl\imgcons.hxx
..\inc\vcl\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx
..\inc\vcl\impdel.hxx %_DEST%\inc%_EXT%\vcl\impdel.hxx
..\inc\vcl\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx
@@ -153,4 +152,4 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\ppdparser.hxx %_DEST%\inc%_EXT%\vcl\ppdparser.hxx
..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx
..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx
-..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx \ No newline at end of file
+..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx
diff --git a/vcl/source/gdi/imgcons.cxx b/vcl/source/gdi/imgcons.cxx
deleted file mode 100644
index 0826c5f2310b..000000000000
--- a/vcl/source/gdi/imgcons.cxx
+++ /dev/null
@@ -1,574 +0,0 @@
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-
-#include <tools/stream.hxx>
-#include <vcl/bmpacc.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/image.hxx>
-#include <vcl/imgcons.hxx>
-
-// -------------------
-// - ImplColorMapper -
-// -------------------
-
-class ImplColorMapper
-{
- Color maCol;
- ULONG mnR;
- ULONG mnG;
- ULONG mnB;
- ULONG mnT;
- ULONG mnRShift;
- ULONG mnGShift;
- ULONG mnBShift;
- ULONG mnTShift;
-
- ULONG ImplCalcMaskShift( ULONG nVal );
-
-public:
-
- ImplColorMapper( ULONG nRMask, ULONG nGMask, ULONG nBMask, ULONG nTMask );
- ~ImplColorMapper();
-
- const Color& ImplGetColor( ULONG nColor )
- {
- maCol.SetRed( (UINT8) ( ( nColor & mnR ) >> mnRShift ) );
- maCol.SetGreen( (UINT8) ( ( nColor & mnG ) >> mnGShift ) );
- maCol.SetBlue( (UINT8) ( ( nColor & mnB ) >> mnBShift ) );
- maCol.SetTransparency( (UINT8) ( ( nColor & mnT ) >> mnTShift ) );
- return maCol;
- }
-};
-
-// -----------------------------------------------------------------------------
-
-ImplColorMapper::ImplColorMapper( ULONG nRMask, ULONG nGMask, ULONG nBMask, ULONG nTMask ) :
- mnR( nRMask ),
- mnG( nGMask ),
- mnB( nBMask ),
- mnT( nTMask )
-{
- mnRShift = ImplCalcMaskShift( mnR );
- mnGShift = ImplCalcMaskShift( mnG );
- mnBShift = ImplCalcMaskShift( mnB );
- mnTShift = ImplCalcMaskShift( mnT );
-}
-
-// -----------------------------------------------------------------------------
-
-ImplColorMapper::~ImplColorMapper()
-{
-}
-
-// -----------------------------------------------------------------------------
-
-ULONG ImplColorMapper::ImplCalcMaskShift( ULONG nVal )
-{
- DBG_ASSERT( nVal > 0, "Mask has no value!" );
-
- ULONG nRet = 0UL;
-
- for( ULONG i = 0UL; i < 32; i++ )
- {
- if( nVal & ( 1UL << i ) )
- {
- nRet = i;
- break;
- }
- }
-
- return nRet;
-}
-
-// -----------------
-// - ImageConsumer -
-// -----------------
-
-ImageConsumer::ImageConsumer() :
- mpMapper( NULL ),
- mpPal ( NULL ),
- mnStatus( 0UL ),
- mbTrans ( FALSE )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-ImageConsumer::~ImageConsumer()
-{
- delete[] mpPal;
- delete mpMapper;
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::Init( sal_uInt32 nWidth, sal_uInt32 nHeight )
-{
- maSize = Size( nWidth, nHeight );
- maBitmap = maMask = Bitmap();
- mnStatus = 0UL;
- mbTrans = FALSE;
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::SetColorModel( USHORT nBitCount,
- sal_uInt32 nPalEntries, const sal_uInt32* pRGBAPal,
- sal_uInt32 nRMask, sal_uInt32 nGMask, sal_uInt32 nBMask, sal_uInt32 nAMask )
-{
- DBG_ASSERT( maSize.Width() && maSize.Height(), "Missing call to ImageConsumer::Init(...)!" );
-
- BitmapPalette aPal( Min( (USHORT) nPalEntries, (USHORT) 256 ) );
-
- if( nPalEntries )
- {
- BitmapColor aCol;
- const sal_Int32* pTmp = (sal_Int32*) pRGBAPal;
-
- delete mpMapper;
- mpMapper = NULL;
-
- delete[] mpPal;
- mpPal = new Color[ nPalEntries ];
-
- for( ULONG i = 0; i < nPalEntries; i++, pTmp++ )
- {
- Color& rCol = mpPal[ i ];
- BYTE cVal;
-
- cVal = (BYTE) ( ( *pTmp & 0xff000000UL ) >> 24L );
- rCol.SetRed( cVal );
-
- if( i < (ULONG) aPal.GetEntryCount() )
- aPal[ (USHORT) i ].SetRed( cVal );
-
- cVal = (BYTE) ( ( *pTmp & 0x00ff0000UL ) >> 16L );
- rCol.SetGreen( cVal );
-
- if( i < (ULONG) aPal.GetEntryCount() )
- aPal[ (USHORT) i ].SetGreen( cVal );
-
- cVal = (BYTE) ( ( *pTmp & 0x0000ff00UL ) >> 8L );
- rCol.SetBlue( cVal );
-
- if( i < (ULONG) aPal.GetEntryCount() )
- aPal[ (USHORT) i ].SetBlue( cVal );
-
- rCol.SetTransparency( (BYTE) ( ( *pTmp & 0x000000ffL ) ) );
- }
-
- if( nBitCount <= 1 )
- nBitCount = 1;
- else if( nBitCount <= 4 )
- nBitCount = 4;
- else if( nBitCount <= 8 )
- nBitCount = 8;
- else
- nBitCount = 24;
- }
- else
- {
- delete mpMapper;
- mpMapper = new ImplColorMapper( nRMask, nGMask, nBMask, nAMask );
-
- delete[] mpPal;
- mpPal = NULL;
-
- nBitCount = 24;
- }
-
- if( !maBitmap )
- {
-
- maBitmap = Bitmap( maSize, nBitCount, &aPal );
- maMask = Bitmap( maSize, 1 );
- maMask.Erase( COL_BLACK );
- mbTrans = FALSE;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::SetPixelsByBytes( sal_uInt32 nConsX, sal_uInt32 nConsY,
- sal_uInt32 nConsWidth, sal_uInt32 nConsHeight,
- const BYTE* pData, sal_uInt32 nOffset, sal_uInt32 nScanSize )
-{
- DBG_ASSERT( !!maBitmap && !!maMask, "Missing call to ImageConsumer::SetColorModel(...)!" );
-
- BitmapWriteAccess* pBmpAcc = maBitmap.AcquireWriteAccess();
- BitmapWriteAccess* pMskAcc = maMask.AcquireWriteAccess();
- sal_Bool bDataChanged = sal_False;
-
- if( pBmpAcc && pMskAcc )
- {
- const long nWidth = pBmpAcc->Width();
- const long nHeight = pBmpAcc->Height();
-
- maChangedRect = Rectangle( Point(), Size( nWidth, nHeight ) );
- maChangedRect.Intersection( Rectangle( Point( nConsX, nConsY ), Size( nConsWidth, nConsHeight ) ) );
-
- if( !maChangedRect.IsEmpty() )
- {
- const long nStartX = maChangedRect.Left();
- const long nEndX = maChangedRect.Right();
- const long nStartY = maChangedRect.Top();
- const long nEndY = maChangedRect.Bottom();
-
- if( mpMapper && ( pBmpAcc->GetBitCount() > 8 ) )
- {
- BitmapColor aCol;
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const Color& rCol = mpMapper->ImplGetColor( *pTmp++ );
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aCol.SetRed( rCol.GetRed() );
- aCol.SetGreen( rCol.GetGreen() );
- aCol.SetBlue( rCol.GetBlue() );
- pBmpAcc->SetPixel( nY, nX, aCol );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else if( mpPal && ( pBmpAcc->GetBitCount() <= 8 ) )
- {
- BitmapColor aIndex( (BYTE) 0 );
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const BYTE cIndex = *pTmp++;
- const Color& rCol = mpPal[ cIndex ];
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aIndex.SetIndex( cIndex );
- pBmpAcc->SetPixel( nY, nX, aIndex );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else if( mpPal && ( pBmpAcc->GetBitCount() > 8 ) )
- {
- BitmapColor aCol;
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const BYTE cIndex = *pTmp++;
- const Color& rCol = mpPal[ cIndex ];
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aCol.SetRed( rCol.GetRed() );
- aCol.SetGreen( rCol.GetGreen() );
- aCol.SetBlue( rCol.GetBlue() );
- pBmpAcc->SetPixel( nY, nX, aCol );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else
- {
- DBG_ERROR( "Producer format error!" );
- maChangedRect.SetEmpty();
- }
- }
- }
- else
- maChangedRect.SetEmpty();
-
- maBitmap.ReleaseAccess( pBmpAcc );
- maMask.ReleaseAccess( pMskAcc );
-
- if( bDataChanged )
- DataChanged();
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::SetPixelsByLongs( sal_uInt32 nConsX, sal_uInt32 nConsY,
- sal_uInt32 nConsWidth, sal_uInt32 nConsHeight,
- const sal_uInt32* pData, sal_uInt32 nOffset, sal_uInt32 nScanSize )
-{
- DBG_ASSERT( !!maBitmap && !!maMask, "Missing call to ImageConsumer::SetColorModel(...)!" );
-
- BitmapWriteAccess* pBmpAcc = maBitmap.AcquireWriteAccess();
- BitmapWriteAccess* pMskAcc = maMask.AcquireWriteAccess();
- sal_Bool bDataChanged = sal_False;
-
- if( pBmpAcc && pMskAcc )
- {
- const long nWidth = pBmpAcc->Width();
- const long nHeight = pBmpAcc->Height();
-
- maChangedRect = Rectangle( Point(), Size( nWidth, nHeight ) );
- maChangedRect.Intersection( Rectangle( Point( nConsX, nConsY ), Size( nConsWidth, nConsHeight ) ) );
-
- if( !maChangedRect.IsEmpty() )
- {
- const long nStartX = maChangedRect.Left();
- const long nEndX = maChangedRect.Right();
- const long nStartY = maChangedRect.Top();
- const long nEndY = maChangedRect.Bottom();
-
- if( mpMapper && ( pBmpAcc->GetBitCount() > 8 ) )
- {
- BitmapColor aCol;
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const sal_Int32* pTmp = (sal_Int32*) pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const Color& rCol = mpMapper->ImplGetColor( *pTmp++ );
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aCol.SetRed( rCol.GetRed() );
- aCol.SetGreen( rCol.GetGreen() );
- aCol.SetBlue( rCol.GetBlue() );
- pBmpAcc->SetPixel( nY, nX, aCol );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else if( mpPal && ( pBmpAcc->GetBitCount() <= 8 ) )
- {
- BitmapColor aIndex( (BYTE) 0 );
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const sal_Int32* pTmp = (sal_Int32*) pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const sal_Int32 nIndex = *pTmp++;
- const Color& rCol = mpPal[ nIndex ];
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aIndex.SetIndex( (BYTE) nIndex );
- pBmpAcc->SetPixel( nY, nX, aIndex );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else if( mpPal && ( pBmpAcc->GetBitCount() > 8 ) )
- {
- BitmapColor aCol;
- BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
-
- for( long nY = nStartY; nY <= nEndY; nY++ )
- {
- const sal_Int32* pTmp = (sal_Int32*) pData + ( nY - nStartY ) * nScanSize + nOffset;
-
- for( long nX = nStartX; nX <= nEndX; nX++ )
- {
- const sal_Int32 nIndex = *pTmp++;
- const Color& rCol = mpPal[ nIndex ];
-
- // 0: Transparent; >0: Non-Transparent
- if( !rCol.GetTransparency() )
- {
- pMskAcc->SetPixel( nY, nX, aMskWhite );
- mbTrans = TRUE;
- }
- else
- {
- aCol.SetRed( rCol.GetRed() );
- aCol.SetGreen( rCol.GetGreen() );
- aCol.SetBlue( rCol.GetBlue() );
- pBmpAcc->SetPixel( nY, nX, aCol );
- }
- }
- }
-
- bDataChanged = sal_True;
- }
- else
- {
- DBG_ERROR( "Producer format error!" );
- maChangedRect.SetEmpty();
- }
- }
- }
- else
- maChangedRect.SetEmpty();
-
- maBitmap.ReleaseAccess( pBmpAcc );
- maMask.ReleaseAccess( pMskAcc );
-
- if( bDataChanged )
- DataChanged();
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::Completed( sal_uInt32 nStatus /*, ImageProducer& rProducer */ )
-{
- delete mpMapper;
- mpMapper = NULL;
- delete[] mpPal;
- mpPal = NULL;
- maSize = Size();
- mnStatus = nStatus;
-
- switch( nStatus )
- {
- case( SINGLEFRAMEDONE ):
- case( STATICIMAGEDONE ):
- {
- if( !mbTrans )
- maMask = Bitmap();
- }
- break;
-
- case( IMAGEERROR ):
- case( IMAGEABORTED ):
- maBitmap = maMask = Bitmap();
- break;
-
- default:
- break;
- }
-
-// rProducer.RemoveConsumer( *this );
-
- if( maDoneLink.IsSet() )
- maDoneLink.Call( this );
-}
-
-// -----------------------------------------------------------------------------
-
-void ImageConsumer::DataChanged()
-{
- if( maChgLink.IsSet() )
- maChgLink.Call( this );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_uInt32 ImageConsumer::GetStatus() const
-{
- return mnStatus;
-}
-
-// -----------------------------------------------------------------------------
-
-BOOL ImageConsumer::GetData( BitmapEx& rBmpEx ) const
-{
- const BOOL bRet = ( SINGLEFRAMEDONE == mnStatus || STATICIMAGEDONE == mnStatus );
-
- if( bRet )
- {
- if( !!maMask )
- rBmpEx = BitmapEx( maBitmap, maMask );
- else
- rBmpEx = BitmapEx( maBitmap );
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-BOOL ImageConsumer::GetData( Image& rImage ) const
-{
- const BOOL bRet = ( SINGLEFRAMEDONE == mnStatus || STATICIMAGEDONE == mnStatus );
-
- if( bRet )
- {
- if( !!maMask )
- rImage = Image( maBitmap, maMask );
- else
- rImage = Image( maBitmap );
- }
-
- return bRet;
-}
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index 55d09d266019..77df20976c73 100644
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -85,7 +85,6 @@ SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/bitmap4.obj \
$(SLO)$/alpha.obj \
$(SLO)$/bitmapex.obj \
- $(SLO)$/imgcons.obj \
$(SLO)$/bmpacc.obj \
$(SLO)$/bmpacc2.obj \
$(SLO)$/bmpacc3.obj \
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 3826a3dbc7b0..bea307a4c38d 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1614,6 +1614,18 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor )
// ------------------------------------------------------------------------
+namespace
+{
+ BYTE lcl_calcColor( const BYTE nSourceColor, const BYTE nSourceOpaq, const BYTE nDestColor )
+ {
+ int c = ( (int)nDestColor * ( 255 - nSourceOpaq ) )
+ + (int)nSourceOpaq * (int)nSourceColor;
+ return BYTE( c / 255 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
BitmapReadAccess* pP,
BitmapReadAccess* pA,
@@ -1626,7 +1638,6 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
const long* pMapY )
{
BitmapColor aDstCol,aSrcCol;
- BYTE nSrcAlpha, nDstAlpha;
Bitmap res;
int nX, nOutX, nY, nOutY;
@@ -1660,36 +1671,23 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
aSrcCol = pP->GetColor( nMapY, nMapX );
aDstCol = pB->GetColor( nY, nX );
- nSrcAlpha = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
- nDstAlpha = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
+ const BYTE nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
+ const BYTE nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
- if( nSrcAlpha + nDstAlpha == 0 )
- {
- // #i70653# zero alpha -> zero color values
- aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ 0 ] + nD ) >> 16UL ] +
- nVCLGLut[ ( nVCLLut[ 0 ] + nD ) >> 16UL ] +
- nVCLBLut[ ( nVCLLut[ 0 ] + nD ) >> 16UL ] ) );
- }
- else
- {
- aDstCol.SetRed( (BYTE)(((int)(aSrcCol.GetRed())*nSrcAlpha + (int)(aDstCol.GetRed())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
- aDstCol.SetGreen( (BYTE)(((int)(aSrcCol.GetGreen())*nSrcAlpha + (int)(aDstCol.GetGreen())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
- aDstCol.SetBlue( (BYTE)(((int)(aSrcCol.GetBlue())*nSrcAlpha + (int)(aDstCol.GetBlue())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
-
- aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] +
- nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] +
- nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) );
- }
+ aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) );
+ aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) );
+ aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), nSrcOpaq, aDstCol.GetGreen() ) );
+
+ aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] +
+ nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] +
+ nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) );
pW->SetPixel( nY, nX, aIndex );
// Have to perform the compositing 'algebra' in
// the inverse alpha space (with 255 meaning
// opaque), otherwise, transitivity is not
// achieved.
- nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstAlpha, nSrcAlpha );
+ const BYTE nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstOpaq, nSrcOpaq );
aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] +
nVCLGLut[ ( nVCLLut[ nSrcAlpha ] + nD ) >> 16UL ] +
@@ -1718,25 +1716,12 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
aSrcCol = pP->GetColor( nMapY, nMapX );
aDstCol = pB->GetColor( nY, nX );
- nSrcAlpha = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
- nDstAlpha = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
+ const BYTE nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
+ const BYTE nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
- if( nSrcAlpha + nDstAlpha == 0 )
- {
- // #i70653# zero alpha -> zero color values
- aDstCol.SetRed(0);
- aDstCol.SetGreen(0);
- aDstCol.SetBlue(0);
- }
- else
- {
- aDstCol.SetRed( (BYTE)(((int)(aSrcCol.GetRed())*nSrcAlpha + (int)(aDstCol.GetRed())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
- aDstCol.SetGreen( (BYTE)(((int)(aSrcCol.GetGreen())*nSrcAlpha + (int)(aDstCol.GetGreen())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
- aDstCol.SetBlue( (BYTE)(((int)(aSrcCol.GetBlue())*nSrcAlpha + (int)(aDstCol.GetBlue())*nDstAlpha) /
- (nSrcAlpha+nDstAlpha)) );
- }
+ aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) );
+ aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) );
+ aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), nSrcOpaq, aDstCol.GetGreen() ) );
pB->SetPixel( nY, nX, aDstCol );
@@ -1744,7 +1729,7 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
// the inverse alpha space (with 255 meaning
// opaque), otherwise, transitivity is not
// achieved.
- nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstAlpha, nSrcAlpha );
+ const BYTE nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, (BYTE)nDstOpaq, nSrcOpaq );
pAlphaW->SetPixel( nY, nX, Color(nSrcAlpha, nSrcAlpha, nSrcAlpha) );
}