changeset 1107:1c64a9cec2f2

Improve performance of pre-multipling for imlib2 image loader
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 06 Dec 2010 01:29:21 +0800
parents b5145de15ace
children 236a47079c2b
files src/img_ldr_imlib2.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}