forked from bartvdbraak/blender
Fix T47827: Single Channel Preview Error
Fix by @sergey with own fix for big endian.
This commit is contained in:
parent
49182111fb
commit
9777c5b0ca
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3237,9 +3237,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;
|
||||
@ -3250,7 +3250,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user