File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,10 +227,10 @@ private void DiffusePixel(int x, int y)
227227 int a_pix = ( int ) Math . Min ( Byte . MaxValue , Math . Max ( error [ 3 ] , 0.0 ) ) ;
228228
229229 Color c2 = Color . FromArgb ( a_pix , r_pix , g_pix , b_pix ) ;
230- if ( saliencies != null && dither && ! sortedByYDiff && ( ! m_hasAlpha || Math . Abs ( pixel . A - a_pix ) < ( .5 * margin ) ) )
230+ if ( saliencies != null && dither && ! sortedByYDiff && ( ! m_hasAlpha || pixel . A < a_pix ) )
231231 {
232- if ( palette . Length >= 256 && saliencies [ bidx ] > .99f )
233- qPixels [ bidx ] = ditherable . DitherColorIndex ( palette , c2 . ToArgb ( ) , bidx ) ;
232+ if ( ( palette . Length >= 256 && saliencies [ bidx ] > .99f ) || ( m_hasAlpha && ( pixel . A - a_pix ) < ( .5 * margin ) ) )
233+ qPixels [ bidx ] = ditherable . DitherColorIndex ( palette , c2 . ToArgb ( ) , bidx ) ;
234234 else
235235 qPixels [ bidx ] = DitherPixel ( x , y , c2 , beta ) ;
236236 }
You can’t perform that action at this time.
0 commit comments