diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-13 16:14:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-14 07:29:33 +0100 |
commit | d03c6ee8d0e2f5637038cf80b890e97630b60b9e (patch) | |
tree | 38f94ba03eeea169e543dd687830da3f60452a92 /svtools/source | |
parent | e7ed95234244b9f3a2c5c3810984627f05e73384 (diff) |
move transparency adjust code to BitmapEx
part of making Bitmap an internal implementation detail of vcl/
Change-Id: I6978d84c86c3d55b3ebbeacda60fd94b160daa29
Reviewed-on: https://gerrit.libreoffice.org/49667
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 451365cd7270..584c31daa07f 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -1452,63 +1452,10 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra rBmpEx.Rotate( aAttr.GetRotation(), Color( COL_TRANSPARENT ) ); } - if( !(( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent()) ) - return; - - AlphaMask aAlpha; - sal_uInt8 cTrans = aAttr.GetTransparency(); - - if( !rBmpEx.IsTransparent() ) - aAlpha = AlphaMask( rBmpEx.GetSizePixel(), &cTrans ); - else if( !rBmpEx.IsAlpha() ) - { - aAlpha = rBmpEx.GetMask(); - aAlpha.Replace( 0, cTrans ); - } - else + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() ) { - aAlpha = rBmpEx.GetAlpha(); - BitmapWriteAccess* pA = aAlpha.AcquireWriteAccess(); - - if( pA ) - { - sal_uLong nTrans = cTrans, nNewTrans; - const long nWidth = pA->Width(), nHeight = pA->Height(); - - if( pA->GetScanlineFormat() == ScanlineFormat::N8BitPal ) - { - for( long nY = 0; nY < nHeight; nY++ ) - { - Scanline pAScan = pA->GetScanline( nY ); - - for( long nX = 0; nX < nWidth; nX++ ) - { - nNewTrans = nTrans + *pAScan; - *pAScan++ = static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ); - } - } - } - else - { - BitmapColor aAlphaValue( 0 ); - - for( long nY = 0; nY < nHeight; nY++ ) - { - Scanline pScanline = pA->GetScanline( nY ); - for( long nX = 0; nX < nWidth; nX++ ) - { - nNewTrans = nTrans + pA->GetIndexFromData( pScanline, nX ); - aAlphaValue.SetIndex( static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) ); - pA->SetPixelOnData( pScanline, nX, aAlphaValue ); - } - } - } - - aAlpha.ReleaseAccess( pA ); - } + rBmpEx.AdjustTransparency(aAttr.GetTransparency()); } - - rBmpEx = BitmapEx( rBmpEx.GetBitmap(), aAlpha ); } void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, GraphicAdjustmentFlags nAdjustmentFlags ) |