Skip to content

Commit 85b55ca

Browse files
author
jef
committed
fix #3626
git-svn-id: http://svn.osgeo.org/qgis/trunk@15520 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 431375f commit 85b55ca

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/core/raster/qgsrasterlayer.cpp

+3-23
Original file line numberDiff line numberDiff line change
@@ -3622,11 +3622,9 @@ void QgsRasterLayer::drawSingleBandColorData( QPainter * theQPainter, QgsRasterV
36223622
QRgb* imageScanLine = 0;
36233623
void* rasterScanLine = 0;
36243624

3625-
QRgb myDefaultColor = qRgba( 255, 255, 255, 0 );
3626-
36273625
while ( imageBuffer.nextScanLine( &imageScanLine, &rasterScanLine ) )
36283626
{
3629-
if ( mTransparencyLevel == 0 )
3627+
if ( mTransparencyLevel == 255 )
36303628
{
36313629
int size = theRasterViewPort->drawableAreaXDim * 4;
36323630
memcpy( imageScanLine, rasterScanLine, size );
@@ -3636,26 +3634,8 @@ void QgsRasterLayer::drawSingleBandColorData( QPainter * theQPainter, QgsRasterV
36363634
uint *p = ( uint* ) rasterScanLine;
36373635
for ( int i = 0; i < theRasterViewPort->drawableAreaXDim; ++i )
36383636
{
3639-
uint v = *p++;
3640-
int myRedValue = ( v & 0xff0000 ) >> 16;
3641-
int myGreenValue = ( v & 0xff00 ) >> 8;
3642-
int myBlueValue = ( v & 0xff );
3643-
3644-
int myAlphaValue = mRasterTransparency.alphaValue( myRedValue, myGreenValue, myBlueValue, mTransparencyLevel );
3645-
if ( 0 == myAlphaValue )
3646-
{
3647-
imageScanLine[ i ] = myDefaultColor;
3648-
continue;
3649-
}
3650-
3651-
if ( mInvertColor )
3652-
{
3653-
myRedValue = 255 - myRedValue;
3654-
myGreenValue = 255 - myGreenValue;
3655-
myBlueValue = 255 - myBlueValue;
3656-
}
3657-
3658-
imageScanLine[ i ] = qRgba( myRedValue, myGreenValue, myBlueValue, myAlphaValue );
3637+
QRgb c( *p++ );
3638+
imageScanLine[ i ] = qRgba( qRed( c ), qGreen( c ), qBlue( c ), mTransparencyLevel );
36593639
}
36603640
}
36613641
}

0 commit comments

Comments
 (0)