Skip to content

Commit 78e59c9

Browse files
committed
limit alpha
1 parent a343cb7 commit 78e59c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gui/qgshighlight.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void QgsHighlight::paint( QPainter* p )
380380
imagePainter->end();
381381

382382
QColor color( mPen.color() ); // true output color
383-
// coeficient to subtract alpha using green (temporary fill)
383+
// coefficient to subtract alpha using green (temporary fill)
384384
double k = ( 255. - mBrush.color().alpha() ) / 255.;
385385
for ( int r = 0; r < image.height(); r++ )
386386
{
@@ -391,7 +391,7 @@ void QgsHighlight::paint( QPainter* p )
391391
if ( alpha > 0 )
392392
{
393393
int green = qGreen( rgba );
394-
color.setAlpha( alpha - ( green * k ) );
394+
color.setAlpha( qBound<int>( 0, alpha - ( green * k ), 255 ) );
395395

396396
image.setPixel( c, r, color.rgba() );
397397
}

0 commit comments

Comments
 (0)