From 3b559c8cc86fab02609556d2bbdd92aa3d1c3cba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Jul 2012 09:22:59 +0000 Subject: [PATCH] rgb color display options for compo backdrop. --- source/blender/editors/space_node/drawnode.c | 20 +++++++++++++++++++- source/blender/makesdna/DNA_space_types.h | 3 +++ source/blender/makesrna/intern/rna_space.c | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index daab0ce0f5f..5596e9151c7 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2951,7 +2951,25 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) } if (ibuf->rect) { - if (snode->flag & SNODE_SHOW_ALPHA) { + if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) { + int ofs; + + if (snode->flag & SNODE_SHOW_R) ofs = 1; + else if (snode->flag & SNODE_SHOW_G) ofs = 2; + else ofs = 3; + + if (ENDIAN_ORDER == B_ENDIAN) { + ofs = 3 - ofs; + } + + glPixelZoom(snode->zoom, snode->zoom); + /* 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, ((unsigned char *)ibuf->rect) + ofs); + + glPixelZoom(1.0f, 1.0f); + } + else if (snode->flag & SNODE_SHOW_ALPHA) { glPixelZoom(snode->zoom, snode->zoom); /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ if (ENDIAN_ORDER == B_ENDIAN) diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 28c386241a7..b3f0950fa75 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -879,6 +879,9 @@ typedef enum eSpaceNode_Flag { /* SNODE_DISPGP = (1 << 2), */ /* XXX: Grease Pencil - deprecated? */ SNODE_USE_ALPHA = (1 << 3), SNODE_SHOW_ALPHA = (1 << 4), + SNODE_SHOW_R = (1 << 7), + SNODE_SHOW_G = (1 << 8), + SNODE_SHOW_B = (1 << 9), SNODE_AUTO_RENDER = (1 << 5), SNODE_SHOW_HIGHLIGHT = (1 << 6), } eSpaceNode_Flag; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index f6286333111..48ae6522da9 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2852,6 +2852,9 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, + {SNODE_SHOW_R, "RED", 0, "Red", ""}, + {SNODE_SHOW_G, "GREEN", 0, "Green", ""}, + {SNODE_SHOW_B, "BLUE", 0, "Blue", ""}, {0, NULL, 0, NULL, NULL} };