diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 16:15:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-17 07:57:52 +0200 |
commit | 58f75fb66a83b1bc7d8297dedc14ade88a9bbc9d (patch) | |
tree | 42792b7d14ba7c5a792bf2c22debab44a460df9d /canvas | |
parent | 51d474abdb8835fe8de055795f17ee580474fab4 (diff) |
drop ModulationMode enum
since we only ever use the MODULE_NONE enumerator
Change-Id: Icd075bb01b5938dbd75b901521d084ddd6469963
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper_texturefill.cxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.cxx | 185 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.hxx | 10 | ||||
-rw-r--r-- | canvas/source/vcl/spritehelper.cxx | 4 |
5 files changed, 35 insertions, 172 deletions
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f13780d143c6..78036a44ff14 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -830,9 +830,7 @@ namespace vclcanvas // complex transformation, use generic affine bitmap // transformation aBmpEx = tools::transformBitmap( aBmpEx, - aMatrix, - renderState.DeviceColor, - tools::MODULATE_NONE ); + aMatrix ); pGrfObj.reset( new GraphicObject( aBmpEx ) ); diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 8f76a08d80a2..dd5236673edb 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -857,9 +857,7 @@ namespace vclcanvas // complex transformation, use generic affine bitmap // transformation aBmpEx = tools::transformBitmap( aBmpEx, - aTotalTransform, - uno::Sequence< double >(), - tools::MODULATE_NONE); + aTotalTransform); pGrfObj.reset( new GraphicObject( aBmpEx ) ); diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index a6e1d7eab563..3689ccedc6c7 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -197,9 +197,7 @@ namespace vclcanvas } ::BitmapEx transformBitmap( const BitmapEx& rBitmap, - const ::basegfx::B2DHomMatrix& rTransform, - const uno::Sequence< double >& rDeviceColor, - ModulationMode eModulationMode ) + const ::basegfx::B2DHomMatrix& rTransform ) { SAL_INFO( "canvas.vcl", "::vclcanvas::tools::transformBitmap()" ); SAL_INFO( "canvas.vcl", "::vclcanvas::tools::transformBitmap: 0x" << std::hex << &rBitmap ); @@ -230,14 +228,6 @@ namespace vclcanvas aSrcRect, rTransform ); - const bool bModulateColors( eModulationMode == MODULATE_WITH_DEVICECOLOR && - rDeviceColor.getLength() > 2 ); - const double nRedModulation( bModulateColors ? rDeviceColor[0] : 1.0 ); - const double nGreenModulation( bModulateColors ? rDeviceColor[1] : 1.0 ); - const double nBlueModulation( bModulateColors ? rDeviceColor[2] : 1.0 ); - const double nAlphaModulation( bModulateColors && rDeviceColor.getLength() > 3 ? - rDeviceColor[3] : 1.0 ); - Bitmap aSrcBitmap( rBitmap.GetBitmap() ); Bitmap aSrcAlpha; @@ -328,163 +318,50 @@ namespace vclcanvas // for the time being, always read as ARGB for( long y=0; y<aDestBmpSize.Height(); ++y ) { - if( bModulateColors ) + // differentiate mask and alpha channel (on-off + // vs. multi-level transparency) + if( rBitmap.IsTransparent() ) { - // TODO(P2): Have different branches for - // alpha-only modulation (color - // modulations eq. 1.0) - - // modulate all color channels with given - // values - - // differentiate mask and alpha channel (on-off - // vs. multi-level transparency) - if( rBitmap.IsTransparent() ) + // Handling alpha and mask just the same... + for( long x=0; x<aDestBmpSize.Width(); ++x ) { - // Handling alpha and mask just the same... - for( long x=0; x<aDestBmpSize.Width(); ++x ) + ::basegfx::B2DPoint aPoint(x,y); + aPoint *= aTransform; + + const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); + const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); + if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || + nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - // modulate alpha with - // nAlphaModulation. This is a - // little bit verbose, formula - // is 255 - (255-pixAlpha)*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha - // channel behaviour) - const sal_uInt8 cMappedAlphaIdx = aAlphaMap[ pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ) ]; - const sal_uInt8 cModulatedAlphaIdx = 255U - static_cast<sal_uInt8>( nAlphaModulation* (255U - cMappedAlphaIdx) + .5 ); - pAlphaWriteAccess->SetPixelIndex( y, x, cModulatedAlphaIdx ); - BitmapColor aColor( pReadAccess->GetPixel( nSrcY, nSrcX ) ); - - aColor.SetRed( - static_cast<sal_uInt8>( - nRedModulation * - aColor.GetRed() + .5 )); - aColor.SetGreen( - static_cast<sal_uInt8>( - nGreenModulation * - aColor.GetGreen() + .5 )); - aColor.SetBlue( - static_cast<sal_uInt8>( - nBlueModulation * - aColor.GetBlue() + .5 )); - - pWriteAccess->SetPixel( y, x, - aColor ); - } + pAlphaWriteAccess->SetPixelIndex( y, x, 255 ); } - } - else - { - for( long x=0; x<aDestBmpSize.Width(); ++x ) + else { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - // modulate alpha with - // nAlphaModulation. This is a - // little bit verbose, formula - // is 255 - 255*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha - // channel behaviour) - pAlphaWriteAccess->SetPixel( y, x, - BitmapColor( - 255U - - static_cast<sal_uInt8>( - nAlphaModulation*255.0 - + .5 ) ) ); - - BitmapColor aColor( pReadAccess->GetPixel( nSrcY, - nSrcX ) ); - - aColor.SetRed( - static_cast<sal_uInt8>( - nRedModulation * - aColor.GetRed() + .5 )); - aColor.SetGreen( - static_cast<sal_uInt8>( - nGreenModulation * - aColor.GetGreen() + .5 )); - aColor.SetBlue( - static_cast<sal_uInt8>( - nBlueModulation * - aColor.GetBlue() + .5 )); - - pWriteAccess->SetPixel( y, x, - aColor ); - } + const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ); + pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] ); + pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); } } } else { - // differentiate mask and alpha channel (on-off - // vs. multi-level transparency) - if( rBitmap.IsTransparent() ) + for( long x=0; x<aDestBmpSize.Width(); ++x ) { - // Handling alpha and mask just the same... - for( long x=0; x<aDestBmpSize.Width(); ++x ) + ::basegfx::B2DPoint aPoint(x,y); + aPoint *= aTransform; + + const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); + const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); + if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || + nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixelIndex( y, x, 255 ); - } - else - { - const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ); - pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); - } + pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); } - } - else - { - for( long x=0; x<aDestBmpSize.Width(); ++x ) + else { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(0) ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, - nSrcX ) ); - } + pAlphaWriteAccess->SetPixel( y, x, BitmapColor(0) ); + pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, + nSrcX ) ); } } } diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx index 62f10814a0c6..d07a841ea754 100644 --- a/canvas/source/vcl/impltools.hxx +++ b/canvas/source/vcl/impltools.hxx @@ -171,16 +171,8 @@ namespace vclcanvas const css::rendering::ViewState& rViewState, const css::rendering::RenderState& rRenderState ); - enum ModulationMode - { - MODULATE_NONE, - MODULATE_WITH_DEVICECOLOR - }; - ::BitmapEx transformBitmap( const BitmapEx& rBitmap, - const ::basegfx::B2DHomMatrix& rTransform, - const css::uno::Sequence< double >& rDeviceColor, - ModulationMode eModulationMode ); + const ::basegfx::B2DHomMatrix& rTransform ); } } diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx index 8dd45e0df909..ee70b21425aa 100644 --- a/canvas/source/vcl/spritehelper.cxx +++ b/canvas/source/vcl/spritehelper.cxx @@ -204,9 +204,7 @@ namespace vclcanvas // actually re-create the bitmap ONLY if necessary if( bNeedBitmapUpdate ) maContent = tools::transformBitmap( *maContent, - aTransform, - uno::Sequence<double>(), - tools::MODULATE_NONE ); + aTransform ); aOutputSize = maContent->GetSizePixel(); } |