mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
2015-10-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBitmapImageRep.m: Correct bug in fast path for image premultiply/unpremultiply. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39062 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
20997976b9
commit
4d5254c74a
2 changed files with 34 additions and 29 deletions
|
@ -1,3 +1,8 @@
|
|||
2015-10-13 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSBitmapImageRep.m: Correct bug in fast path for image
|
||||
premultiply/unpremultiply.
|
||||
|
||||
2015-10-10 Gregory Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSAnimationContext.h
|
||||
|
|
|
@ -2088,29 +2088,30 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
|
||||
for (y = 0; y < _pixelsHigh; y++)
|
||||
{
|
||||
line_offset = _bytesPerRow * y + _bitsPerPixel / 8;
|
||||
line_offset = _bytesPerRow * y;
|
||||
for (x = 0; x < _pixelsWide; x++)
|
||||
{
|
||||
offset = x + line_offset;
|
||||
offset = (_bitsPerPixel * x) / 8 + line_offset;
|
||||
a = _imagePlanes[0][offset + ai];
|
||||
if ((a != 0) && (a != 255))
|
||||
if (a != 255)
|
||||
{
|
||||
for (i = start; i < end; i++)
|
||||
if (a == 0)
|
||||
{
|
||||
NSUInteger v = _imagePlanes[0][offset + i];
|
||||
NSUInteger c;
|
||||
|
||||
c = (v * 255) / a;
|
||||
if (c >= 255)
|
||||
for (i = start; i < end; i++)
|
||||
{
|
||||
v = 255;
|
||||
_imagePlanes[0][offset + i] = 0;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = start; i < end; i++)
|
||||
{
|
||||
v = c;
|
||||
NSUInteger v = _imagePlanes[0][offset + i];
|
||||
NSUInteger t = a * v + 0x80;
|
||||
|
||||
v = ((t >> 8) + t) >> 8;
|
||||
_imagePlanes[0][offset + i] = v;
|
||||
}
|
||||
|
||||
_imagePlanes[0][offset + i] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2205,30 +2206,29 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
|
||||
for (y = 0; y < _pixelsHigh; y++)
|
||||
{
|
||||
line_offset = _bytesPerRow * y + _bitsPerPixel / 8;
|
||||
line_offset = _bytesPerRow * y;
|
||||
for (x = 0; x < _pixelsWide; x++)
|
||||
{
|
||||
offset = x + line_offset;
|
||||
offset = (_bitsPerPixel * x) / 8 + line_offset;
|
||||
a = _imagePlanes[0][offset + ai];
|
||||
if (a != 255)
|
||||
if ((a != 0) && (a != 255))
|
||||
{
|
||||
if (a == 0)
|
||||
for (i = start; i < end; i++)
|
||||
{
|
||||
for (i = start; i < end; i++)
|
||||
NSUInteger v = _imagePlanes[0][offset + i];
|
||||
NSUInteger c;
|
||||
|
||||
c = (v * 255) / a;
|
||||
if (c >= 255)
|
||||
{
|
||||
_imagePlanes[0][offset + i] = 0;
|
||||
v = 255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = start; i < end; i++)
|
||||
else
|
||||
{
|
||||
NSUInteger v = _imagePlanes[0][offset + i];
|
||||
NSUInteger t = a * v + 0x80;
|
||||
|
||||
v = ((t >> 8) + t) >> 8;
|
||||
_imagePlanes[0][offset + i] = v;
|
||||
v = c;
|
||||
}
|
||||
|
||||
_imagePlanes[0][offset + i] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue