# HG changeset patch # User Thinker K.F. Li # Date 1291570161 -28800 # Node ID 1c64a9cec2f255b9d03ba04d9f5cd825cc8233a4 # Parent b5145de15ace53171ff0838f6d4c83e10da68790 Improve performance of pre-multipling for imlib2 image loader diff -r b5145de15ace -r 1c64a9cec2f2 src/img_ldr_imlib2.c --- a/src/img_ldr_imlib2.c Mon Dec 06 01:05:32 2010 +0800 +++ b/src/img_ldr_imlib2.c Mon Dec 06 01:29:21 2010 +0800 @@ -81,13 +81,15 @@ for(j = 0; j < w; j++) { value = data[pos]; alpha = value >> 24; - if(alpha == 0) - value = 0; - else if(alpha != 0xff) { - value = (value & 0xff000000) | - (((value & 0xff0000) * alpha / 0xff) & 0xff0000) | - (((value & 0xff00) * alpha / 0xff) & 0xff00) | - ((value & 0xff) * alpha / 0xff); + if(alpha != 0xff) { + if(alpha == 0) + value = 0; + else { + value = (value & 0xff000000) | + (((value & 0xff0000) * alpha / 0xff) & 0xff0000) | + (((value & 0xff00) * alpha / 0xff) & 0xff00) | + ((value & 0xff) * alpha / 0xff); + } } premultiple_data[pos++] = value; }