diff options
author | Kent Mein <mein@cs.umn.edu> | 2006-03-01 02:58:17 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2006-03-01 02:58:17 +0300 |
commit | fc9615f15e69ead939de1731586df042b9130f63 (patch) | |
tree | 4045a2f03ca0c4f9776be483566fa0c51f89f506 /source/blender/imbuf/intern | |
parent | 3ecee5f15475fd0ae9b4e492e1015aa7136a8189 (diff) |
reverted the looping vs switch statement. I don't know what I was thinking
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
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 906e69f0a28..cd90adda27a 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -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); |