summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-03-06 20:36:06 +0100
committerTor Lillqvist <tlillqvist@suse.com>2012-03-19 08:19:10 +0200
commita1a4b8cdd14843457e520fa9494892e9704557d4 (patch)
tree5aabf8d2c2b689b62957beb5d1a3bc09274418a8
parenteb1400e33049b447869234134da59afe6553ad72 (diff)
Consistent use of alpha in cairocanvas
Use GetIndex() instead of GetBlue() (does the same, but more self-documenting); use opaque when no alpha channel consistently. (cherry picked from commit 83114b27fac8ef723cbbaa734237210d9ad56a15) Signed-off-by: Tor Lillqvist <tlillqvist@suse.com>
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 6accc396c824..c5876a7c5461 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -368,7 +368,7 @@ namespace cairocanvas
case BMP_FORMAT_8BIT_PAL:
pReadScan = pAlphaReadAcc->GetScanline( nY );
for( nX = 0; nX < nWidth; nX++ ) {
- nAlpha = data[ nOff ] = 255 - ( pAlphaReadAcc->GetPaletteColor( *pReadScan++ ).GetBlue() );
+ nAlpha = data[ nOff ] = 255 - ( pAlphaReadAcc->GetPaletteColor( *pReadScan++ ).GetIndex() );
if( nAlpha != 255 )
bIsAlpha = true;
nOff += 4;
@@ -377,7 +377,7 @@ namespace cairocanvas
default:
OSL_TRACE( "fallback to GetColor for alpha - slow, format: %d", pAlphaReadAcc->GetScanlineFormat() );
for( nX = 0; nX < nWidth; nX++ ) {
- nAlpha = data[ nOff ] = 255 - pAlphaReadAcc->GetColor( nY, nX ).GetBlue();
+ nAlpha = data[ nOff ] = 255 - pAlphaReadAcc->GetColor( nY, nX ).GetIndex();
if( nAlpha != 255 )
bIsAlpha = true;
nOff += 4;
@@ -541,7 +541,7 @@ namespace cairocanvas
if( pAlphaReadAcc )
nAlpha = data[ nOff++ ];
else
- nAlpha = data[ nOff++ ] = pReadScan[ 3 ];
+ nAlpha = data[ nOff++ ] = 255;
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 2 ] ) )/255 );
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 1 ] ) )/255 );
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 0 ] ) )/255 );
@@ -550,7 +550,7 @@ namespace cairocanvas
if( pAlphaReadAcc )
nAlpha = data[ nOff + 3 ];
else
- nAlpha = data[ nOff + 3 ] = pReadScan[ 3 ];
+ nAlpha = data[ nOff + 3 ] = 255;
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );
data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );