diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 09:49:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 10:08:30 +0100 |
commit | e5012e53b919ae4921d6d35660bde323a6f28417 (patch) | |
tree | d0ed24f56e29f5d027e21404696fca441cdd0fc5 /forms/source | |
parent | c99527385acf367c748b3dcf3e6a3bb8103f5eee (diff) |
use scanline when reading pixel data
extracts code from the innermost part of fairly hot loops
And add a GetIndexFromData method to make the call sites a little easier
to read.
Change-Id: I4ce5c5a687ecdb6982562a0aafce8513d86f9107
Reviewed-on: https://gerrit.libreoffice.org/49337
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/imgprod.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index 44cb05d36715..40bfe13b78bb 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -437,13 +437,15 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) for( long nY = nStartY; nY <= nEndY; nY++ ) { + Scanline pScanlineMask = pMskAcc->GetScanline( nY ); + Scanline pScanline = pBmpAcc->GetScanline( nY ); for( long nX = nStartX; nX <= nEndX; nX++ ) { - if( pMskAcc->GetPixel( nY, nX ) == aWhite ) + if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) == aWhite ) *pTmp++ = sal::static_int_cast< sal_Int8 >( mnTransIndex ); else - *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex(); + *pTmp++ = pBmpAcc->GetPixelFromData( pScanline, nX ).GetIndex(); } } @@ -458,12 +460,14 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) for( long nY = nStartY; nY <= nEndY; nY++ ) { + Scanline pScanlineMask = pMskAcc->GetScanline( nY ); + Scanline pScanline = pBmpAcc->GetScanline( nY ); for( long nX = nStartX; nX <= nEndX; nX++ ) { - if( pMskAcc->GetPixel( nY, nX ) == aWhite ) + if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) == aWhite ) *pTmp++ = mnTransIndex; else - *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex(); + *pTmp++ = pBmpAcc->GetPixelFromData( pScanline, nX ).GetIndex(); } } @@ -480,15 +484,17 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) for( long nY = nStartY; nY <= nEndY; nY++ ) { + Scanline pScanlineMask = pMskAcc->GetScanline( nY ); + Scanline pScanline = pBmpAcc->GetScanline( nY ); for( long nX = nStartX; nX <= nEndX; nX++, pTmp++ ) { - const BitmapColor aCol( pBmpAcc->GetPixel( nY, nX ) ); + const BitmapColor aCol( pBmpAcc->GetPixelFromData( pScanline, nX ) ); *pTmp = static_cast<sal_Int32>(aCol.GetRed()) << 24; *pTmp |= static_cast<sal_Int32>(aCol.GetGreen()) << 16; *pTmp |= static_cast<sal_Int32>(aCol.GetBlue()) << 8; - if( pMskAcc->GetPixel( nY, nX ) != aWhite ) + if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) != aWhite ) *pTmp |= 0x000000ffUL; } } |