mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:01:16 +00:00
* Source/NSBitmapImageRep.m (-_convertToFormatBitsPerSample:...):
+ Correct division by zero bug in image conversion.
This commit is contained in:
parent
ecb1cb0f48
commit
7f07e4dd43
2 changed files with 9 additions and 2 deletions
|
@ -2429,7 +2429,8 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
}
|
||||
fa = ia / _scale;
|
||||
|
||||
if ((_format & NSAlphaNonpremultipliedBitmapFormat) !=
|
||||
if ((ia != 0 && fa < 1.0) &&
|
||||
(_format & NSAlphaNonpremultipliedBitmapFormat) !=
|
||||
(bitmapFormat & NSAlphaNonpremultipliedBitmapFormat))
|
||||
{
|
||||
if (_format & NSAlphaNonpremultipliedBitmapFormat)
|
||||
|
@ -2568,7 +2569,8 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
fv = iv / _scale;
|
||||
fa = ia / _scale;
|
||||
|
||||
if ((_format & NSAlphaNonpremultipliedBitmapFormat) !=
|
||||
if ((ia != 0 && fa < 1.0) &&
|
||||
(_format & NSAlphaNonpremultipliedBitmapFormat) !=
|
||||
(bitmapFormat & NSAlphaNonpremultipliedBitmapFormat))
|
||||
{
|
||||
if (_format & NSAlphaNonpremultipliedBitmapFormat)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue