* Source/NSBitmapImageRep.m (-_convertToFormatBitsPerSample:...bitsPerPixel:): Correct

handling of black data.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34762 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2012-02-15 22:04:08 +00:00
parent b18a55a842
commit 4d8bbcfe9b
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2012-02-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBitmapImageRep.m
(-_convertToFormatBitsPerSample:...bitsPerPixel:): Correct
handling of black data.
2012-02-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPasteboard.m: Use an NSMapTable to store pasteboards so we

View file

@ -484,6 +484,8 @@
bytesPerRow: (int)rowBytes
bitsPerPixel: (int)pixelBits
{
NSDebugLLog(@"NSImage", @"Creating bitmap image with pw %d ph %d bps %d spp %d alpha %d, planar %d cs %@",
width, height, bps, spp, alpha, isPlanar, colorSpaceName);
if (!bps || !spp || !width || !height)
{
[NSException raise: NSInvalidArgumentException
@ -753,7 +755,7 @@ _get_bit_value(unsigned char *base, long msb_off, int bit_width)
long int offset;
long int line_offset;
if (x < 0 || y < 0 || x >= _pixelsWide || y >= _pixelsHigh)
if (x < 0 || y < 0 || x >= _pixelsWide || y >= _pixelsHigh)
{
// outside
return;
@ -781,7 +783,7 @@ _get_bit_value(unsigned char *base, long msb_off, int bit_width)
}
}
else
{
{
if (_bitsPerSample == 8)
{
offset = (_bitsPerPixel * x) / 8 + line_offset;
@ -800,7 +802,7 @@ _get_bit_value(unsigned char *base, long msb_off, int bit_width)
offset += _bitsPerSample;
}
}
}
}
}
static void
@ -2308,7 +2310,7 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
int x, y;
CGFloat _scale;
CGFloat scale;
int max = (1 << bps) - 1;
int max = (1 << _bitsPerSample) - 1;
BOOL isWhite = [_colorSpace isEqualToString: NSCalibratedWhiteColorSpace]
|| [_colorSpace isEqualToString: NSDeviceWhiteColorSpace];