|
@@ -267,23 +267,44 @@ QgsRasterBlock *QgsMultiBandColorRenderer::block( int bandNo, QgsRectangle cons |
|
|
{ |
|
|
if ( fastDraw ) //fast rendering if no transparency, stretching, color inversion, etc. |
|
|
{ |
|
|
if ( redBlock->isNoData( i ) || |
|
|
greenBlock->isNoData( i ) || |
|
|
blueBlock->isNoData( i ) ) |
|
|
if ( hasByteRgb ) |
|
|
{ |
|
|
outputBlock->setColor( i, myDefaultColor ); |
|
|
if ( redBlock->isNoData( i ) || |
|
|
greenBlock->isNoData( i ) || |
|
|
blueBlock->isNoData( i ) ) |
|
|
{ |
|
|
outputBlock->setColor( i, myDefaultColor ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
outputBlockColorData[i] = qRgb( redData[i], greenData[i], blueData[i] ); |
|
|
} |
|
|
} |
|
|
else |
|
|
{ |
|
|
if ( hasByteRgb ) |
|
|
bool redIsNoData = false; |
|
|
bool greenIsNoData = false; |
|
|
bool blueIsNoData = false; |
|
|
int redVal = 0; |
|
|
int greenVal = 0; |
|
|
int blueVal = 0; |
|
|
|
|
|
redVal = redBlock->valueAndNoData( i, redIsNoData ); |
|
|
// as soon as any channel has a no data value, don't do any more work -- the result will |
|
|
// always be the nodata color! |
|
|
if ( !redIsNoData ) |
|
|
greenVal = greenBlock->valueAndNoData( i, greenIsNoData ); |
|
|
if ( !redIsNoData && !greenIsNoData ) |
|
|
blueVal = blueBlock->valueAndNoData( i, blueIsNoData ); |
|
|
|
|
|
if ( redIsNoData || |
|
|
greenIsNoData || |
|
|
blueIsNoData ) |
|
|
{ |
|
|
outputBlockColorData[i] = qRgb( redData[i], greenData[i], blueData[i] ); |
|
|
outputBlock->setColor( i, myDefaultColor ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
int redVal = static_cast<int>( redBlock->value( i ) ); |
|
|
int greenVal = static_cast<int>( greenBlock->value( i ) ); |
|
|
int blueVal = static_cast<int>( blueBlock->value( i ) ); |
|
|
outputBlockColorData[i] = qRgb( redVal, greenVal, blueVal ); |
|
|
} |
|
|
} |
|
|