Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-17 15:52:49 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-03-18 13:44:23 +0300
commit90758ed2e85a18e6c5eea276ceacf61410e3d84d (patch)
tree4f55a8b6a3b6e1a10cc0e05c89a47203b0180961
parent80b906cb3135f9f6547b47150ec752e96df0255e (diff)
Fix T47827: Single Channel Preview Error
Fix by @sergey with own fix for big endian.
-rw-r--r--source/blender/editors/space_image/image_draw.c8
-rw-r--r--source/blender/editors/space_node/drawnode.c6
2 files changed, 7 insertions, 7 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));
}
}
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index ed207e2da02..61341fb2453 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);
}