Commit: 90758ed2e85a18e6c5eea276ceacf61410e3d84d
Author: Campbell Barton
Date: Thu Mar 17 23:52:49 2016 +1100
Branches: blender-v2.77-release
https://developer.blender.org/rB90758ed2e85a18e6c5eea276ceacf61410e3d84d
Fix T47827: Single Channel Preview Error
Fix by @sergey with own fix for big endian.
===================================================================
M source/blender/editors/space_image/image_draw.c
M source/blender/editors/space_node/drawnode.c
===================================================================
diff --git a/source/blender/editors/space_image/image_draw.c
b/source/blender/editors/space_image/image_draw.c
index 669fbd2..0ddbb11 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));
}
}
}
diff --git a/source/blender/editors/space_node/drawnode.c
b/source/blender/editors/space_node/drawnode.c
index ed207e2..61341fb 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3236,9 +3236,9 @@ void draw_nodespace_back_pix(const bContext *C, ARegion
*ar, SpaceNode *snode, b
display_buffer =
IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
#ifdef __BIG_ENDIAN__
- if (snode->flag & SNODE_SHOW_R) ofs = 2;
+ if (snode->flag & SNODE_SHOW_R) ofs = 0;
else if (snode->flag & SNODE_SHOW_G) ofs = 1;
- else ofs = 0;
+ else ofs = 2;
#else
if (snode->flag & SNODE_SHOW_R) ofs = 1;
else if (snode->flag & SNODE_SHOW_G) ofs = 2;
@@ -3249,7 +3249,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion
*ar, SpaceNode *snode, b
/* swap bytes, so alpha is most significant
one, then just draw it as luminance int */
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y,
ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT,
- display_buffer + ofs);
+ display_buffer - (4 - ofs));
glPixelZoom(1.0f, 1.0f);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs