reverted the looping vs switch statement. I don't know what I was thinking
authorKent Mein <mein@cs.umn.edu>
Tue, 28 Feb 2006 23:58:17 +0000 (23:58 +0000)
committerKent Mein <mein@cs.umn.edu>
Tue, 28 Feb 2006 23:58:17 +0000 (23:58 +0000)
in doing this in the first place.  (1 conditional vs 1 per loop duh)
Thanks for calling me on this Alexander.

(I didn't actually benchmark it to see but its pretty obvious which is less
work for the computer.)

Kent

source/blender/imbuf/intern/jpeg.c

index 906e69f0a285c439e5b03c056e5a40f24b5197e1..cd90adda27af259b2f81c6c93c121e557ab450c4 100644 (file)
@@ -286,21 +286,25 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
                                }
                                buffer = row_pointer[0];
                                
-                               for (x=ibuf->x; x >0; x--) {
-                                       switch(depth) {
-                                               case 1:
+                               switch(depth) {
+                                       case 1:
+                                               for (x=ibuf->x; x >0; x--) {
                                                        rect[3] = 255;
                                                        rect[0] = rect[1] = rect[2] = *buffer++;
                                                        rect += 4;
+                                               }
                                                        break;
-                                               case 3:
+                                       case 3:
+                                               for (x=ibuf->x; x >0; x--) {
                                                        rect[3] = 255;
                                                        rect[0] = *buffer++;
                                                        rect[1] = *buffer++;
                                                        rect[2] = *buffer++;
                                                        rect += 4;
+                                               }
                                                        break;
-                                               case 4:
+                                       case 4:
+                                               for (x=ibuf->x; x >0; x--) {
                                                        r = *buffer++;
                                                        g = *buffer++;
                                                        b = *buffer++;
@@ -328,7 +332,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
                                                        rect[1] = g;
                                                        rect[0] = r;
                                                        rect += 4;
-                                       }
+                                               }
                                }
                        }
                        jpeg_finish_decompress(cinfo);