mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Merge pull request #1088 from bgilbert/opaque-RGBa
Fast path for opaque pixels in RGBa unpacker
This commit is contained in:
commit
b384a7f992
|
@ -638,7 +638,12 @@ unpackRGBa(UINT8* out, const UINT8* in, int pixels)
|
|||
int a = in[3];
|
||||
if (!a)
|
||||
out[R] = out[G] = out[B] = out[A] = 0;
|
||||
else {
|
||||
else if (a == 255) {
|
||||
out[R] = in[0];
|
||||
out[G] = in[1];
|
||||
out[B] = in[2];
|
||||
out[A] = a;
|
||||
} else {
|
||||
out[R] = CLIP(in[0] * 255 / a);
|
||||
out[G] = CLIP(in[1] * 255 / a);
|
||||
out[B] = CLIP(in[2] * 255 / a);
|
||||
|
|
Loading…
Reference in New Issue
Block a user