@@ -3622,11 +3622,9 @@ void QgsRasterLayer::drawSingleBandColorData( QPainter * theQPainter, QgsRasterV
3622
3622
QRgb* imageScanLine = 0 ;
3623
3623
void * rasterScanLine = 0 ;
3624
3624
3625
- QRgb myDefaultColor = qRgba ( 255 , 255 , 255 , 0 );
3626
-
3627
3625
while ( imageBuffer.nextScanLine ( &imageScanLine, &rasterScanLine ) )
3628
3626
{
3629
- if ( mTransparencyLevel == 0 )
3627
+ if ( mTransparencyLevel == 255 )
3630
3628
{
3631
3629
int size = theRasterViewPort->drawableAreaXDim * 4 ;
3632
3630
memcpy ( imageScanLine, rasterScanLine, size );
@@ -3636,26 +3634,8 @@ void QgsRasterLayer::drawSingleBandColorData( QPainter * theQPainter, QgsRasterV
3636
3634
uint *p = ( uint * ) rasterScanLine;
3637
3635
for ( int i = 0 ; i < theRasterViewPort->drawableAreaXDim ; ++i )
3638
3636
{
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 );
3659
3639
}
3660
3640
}
3661
3641
}
0 commit comments