From b56d8f3f1f42daf9a96df90f9495b4d12f580869 Mon Sep 17 00:00:00 2001 From: homm Date: Thu, 26 May 2016 15:22:01 +0300 Subject: [PATCH] speedup La -> LA conversion in most cases --- libImaging/Convert.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libImaging/Convert.c b/libImaging/Convert.c index 5aad3733c..99d5ae10d 100644 --- a/libImaging/Convert.c +++ b/libImaging/Convert.c @@ -140,11 +140,11 @@ la2lA(UINT8* out, const UINT8* in, int xsize) unsigned int alpha, pixel; for (x = 0; x < xsize; x++, in+=4) { alpha = in[3]; - if (alpha) { - pixel = CLIP((255 * in[0]) / alpha); - } else { + if (alpha == 255 || alpha == 0) { pixel = in[0]; - } + } else { + pixel = CLIP((255 * in[0]) / alpha); + } *out++ = (UINT8) pixel; *out++ = (UINT8) pixel; *out++ = (UINT8) pixel;