Kaydet (Commit) b7442df1 authored tarafından Thomas Arnhold's avatar Thomas Arnhold

callcatcher: clean up ImplImageBmp

üst bc34a22e
......@@ -44,21 +44,8 @@ public:
ImplImageBmp();
~ImplImageBmp();
void Create( long nItemWidth, long nItemHeight, sal_uInt16 nInitSize );
void Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
void Expand( sal_uInt16 nGrowSize );
void Replace( sal_uInt16 nPos, sal_uInt16 nSrcPos );
void Replace( sal_uInt16 nPos, const ImplImageBmp& rImageBmp, sal_uInt16 nSrcPos );
void Replace( sal_uInt16 nPos, const BitmapEx& rBmpEx );
void ReplaceColors( const Color* pSrcColors, const Color* pDstColors, sal_uIntPtr nColorCount );
void ColorTransform();
void Invert();
BitmapEx GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const;
void Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
private:
......
......@@ -214,26 +214,6 @@ ImplImageBmp::~ImplImageBmp()
// -----------------------------------------------------------------------
void ImplImageBmp::Create( long nItemWidth, long nItemHeight, sal_uInt16 nInitSize )
{
const Size aTotalSize( nInitSize * nItemWidth, nItemHeight );
maBmpEx = Bitmap( aTotalSize, 24 );
maDisabledBmpEx.SetEmpty();
delete mpDisplayBmp;
mpDisplayBmp = NULL;
maSize = Size( nItemWidth, nItemHeight );
mnSize = nInitSize;
delete[] mpInfoAry;
mpInfoAry = new sal_uInt8[ mnSize ];
memset( mpInfoAry, 0, mnSize );
}
// -----------------------------------------------------------------------
void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight, sal_uInt16 nInitSize )
{
maBmpEx = rBmpEx;
......@@ -254,131 +234,6 @@ void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHe
// -----------------------------------------------------------------------
void ImplImageBmp::Expand( sal_uInt16 nGrowSize )
{
const sal_uLong nDX = nGrowSize * maSize.Width();
const sal_uInt16 nOldSize = mnSize;
sal_uInt8* pNewAry = new sal_uInt8[ mnSize = sal::static_int_cast<sal_uInt16>(mnSize+nGrowSize) ];
maBmpEx.Expand( nDX, 0UL );
if( !maDisabledBmpEx.IsEmpty() )
maDisabledBmpEx.Expand( nDX, 0UL );
delete mpDisplayBmp;
mpDisplayBmp = NULL;
memset( pNewAry, 0, mnSize );
memcpy( pNewAry, mpInfoAry, nOldSize );
delete[] mpInfoAry;
mpInfoAry = pNewAry;
}
// -----------------------------------------------------------------------
void ImplImageBmp::Invert()
{
delete mpDisplayBmp;
mpDisplayBmp = NULL;
maBmpEx.Invert();
}
// -----------------------------------------------------------------------
void ImplImageBmp::Replace( sal_uInt16 nPos, sal_uInt16 nSrcPos )
{
const Point aSrcPos( nSrcPos * maSize.Width(), 0L ), aPos( nPos * maSize.Width(), 0L );
const Rectangle aSrcRect( aSrcPos, maSize );
const Rectangle aDstRect( aPos, maSize );
maBmpEx.CopyPixel( aDstRect, aSrcRect );
if( !maDisabledBmpEx.IsEmpty() )
maDisabledBmpEx.CopyPixel( aDstRect, aSrcRect );
delete mpDisplayBmp;
mpDisplayBmp = NULL;
mpInfoAry[ nPos ] = mpInfoAry[ nSrcPos ];
}
// -----------------------------------------------------------------------
void ImplImageBmp::Replace( sal_uInt16 nPos, const ImplImageBmp& rImageBmp, sal_uInt16 nSrcPos )
{
const Point aSrcPos( nSrcPos * maSize.Width(), 0L ), aPos( nPos * maSize.Width(), 0L );
const Rectangle aSrcRect( aSrcPos, maSize );
const Rectangle aDstRect( aPos, maSize );
maBmpEx.CopyPixel( aDstRect, aSrcRect, &rImageBmp.maBmpEx );
ImplUpdateDisabledBmpEx( nPos );
delete mpDisplayBmp;
mpDisplayBmp = NULL;
mpInfoAry[ nPos ] = rImageBmp.mpInfoAry[ nSrcPos ];
}
// -----------------------------------------------------------------------
void ImplImageBmp::Replace( sal_uInt16 nPos, const BitmapEx& rBmpEx )
{
const Point aNullPos, aPos( nPos * maSize.Width(), 0L );
const Rectangle aSrcRect( aNullPos, maSize );
const Rectangle aDstRect( aPos, maSize );
maBmpEx.CopyPixel( aDstRect, aSrcRect, &rBmpEx );
ImplUpdateDisabledBmpEx( nPos );
delete mpDisplayBmp;
mpDisplayBmp = NULL;
mpInfoAry[ nPos ] &= ~( IMPSYSIMAGEITEM_MASK | IMPSYSIMAGEITEM_ALPHA );
mpInfoAry[ nPos ] |= ( rBmpEx.IsAlpha() ? IMPSYSIMAGEITEM_ALPHA : ( rBmpEx.IsTransparent() ? IMPSYSIMAGEITEM_MASK : 0 ) );
}
// -----------------------------------------------------------------------
void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColors, sal_uLong nColorCount )
{
maBmpEx.Replace( pSrcColors, pDstColors, nColorCount );
delete mpDisplayBmp;
mpDisplayBmp = NULL;
}
// -----------------------------------------------------------------------
BitmapEx ImplImageBmp::GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const
{
const Bitmap aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ), maBmpEx.GetBitmap().GetBitCount() );
BitmapEx aRet;
if( maBmpEx.IsAlpha() )
{
// initialize target bitmap with an empty alpha mask
// which allows for using an optimized copypixel later on (see AlphaMask::CopyPixel)
// that avoids palette lookups
AlphaMask aAlpha( Size( nPosCount * maSize.Width(), maSize.Height() ) );
aRet = BitmapEx( aNewBmp, aAlpha );
}
else
aRet = BitmapEx( aNewBmp );
for( sal_uInt16 i = 0; i < nPosCount; i++ )
{
const Point aSrcPos( pPosAry[ i ] * maSize.Width(), 0L );
const Point aPos( i * maSize.Width(), 0L );
const Rectangle aSrcRect( aSrcPos, maSize );
const Rectangle aDstRect( aPos, maSize );
aRet.CopyPixel( aDstRect, aSrcRect, &maBmpEx );
}
return aRet;
}
// -----------------------------------------------------------------------
void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
const Point& rPos, sal_uInt16 nStyle,
const Size* pSize )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment