diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-17 15:52:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-03-17 15:52:49 +0300 |
commit | 9777c5b0cafaaffb8ef224465785081f60efa2f8 (patch) | |
tree | 220de6d37ecc08f100f379d917619ba831223460 /source/blender/editors/space_image/image_draw.c | |
parent | 49182111fb1fc87b18ef951cd3a44b4ff22dee2f (diff) |
Fix T47827: Single Channel Preview Error
Fix by @sergey with own fix for big endian.
Diffstat (limited to 'source/blender/editors/space_image/image_draw.c')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 669fbd28a05..0ddbb1153c0 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -480,9 +480,9 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec static int draw_image_channel_offset(SpaceImage *sima) { #ifdef __BIG_ENDIAN__ - if (sima->flag & SI_SHOW_R) return 2; + if (sima->flag & SI_SHOW_R) return 0; else if (sima->flag & SI_SHOW_G) return 1; - else return 0; + else return 2; #else if (sima->flag & SI_SHOW_R) return 1; else if (sima->flag & SI_SHOW_G) return 2; @@ -540,7 +540,7 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar, if (display_buffer != NULL) { int channel_offset = draw_image_channel_offset(sima); glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, - display_buffer + channel_offset); + display_buffer - (4 - channel_offset)); } if (cache_handle != NULL) { IMB_display_buffer_release(cache_handle); @@ -621,7 +621,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, } else { glaDrawPixelsSafe(x, y, dx, dy, dx, GL_LUMINANCE, GL_UNSIGNED_INT, - (unsigned char *)rect + channel_offset); + (unsigned char *)rect - (4 - channel_offset)); } } } |