mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-05 06:00:58 +03:00
Moved strcmp outside of loop
This commit is contained in:
parent
83d4f451fa
commit
41a9975377
|
@ -1029,12 +1029,13 @@ pa2l(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||||
static void
|
static void
|
||||||
p2pa(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
p2pa(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||||
int x;
|
int x;
|
||||||
|
int rgb = strcmp(palette->mode, "RGB");
|
||||||
for (x = 0; x < xsize; x++, in++) {
|
for (x = 0; x < xsize; x++, in++) {
|
||||||
const UINT8 *rgba = &palette->palette[in[0]];
|
const UINT8 *rgba = &palette->palette[in[0]];
|
||||||
*out++ = in[0];
|
*out++ = in[0];
|
||||||
*out++ = in[0];
|
*out++ = in[0];
|
||||||
*out++ = in[0];
|
*out++ = in[0];
|
||||||
*out++ = strcmp(palette->mode, "RGB") == 0 ? 255 : rgba[3];
|
*out++ = rgb == 0 ? 255 : rgba[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user