diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-28 17:29:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-28 17:29:33 +0400 |
commit | b9ff5840a617ec836f2d09bb0f04d60e5c3b8f67 (patch) | |
tree | 8a196777f4ee32e3ee089c12b667caa2c82dec75 /source/blender/nodes/composite/node_composite_util.c | |
parent | 1f02209957fc8afde957b48f1be41fc399a725b0 (diff) |
Code refactoring: add unified image buffer functions for doing float => byte,
byte => float, float => float, byte => byte conversions with profile, dither
and predivide. Previously code for this was spread out too much.
There should be no functional changes, this is so the predivide/table/dither
patches can work correctly.
Diffstat (limited to 'source/blender/nodes/composite/node_composite_util.c')
-rw-r--r-- | source/blender/nodes/composite/node_composite_util.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 99a36691b10..8aaf1771b68 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -606,7 +606,9 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) RenderData *rd= data; bNodePreview *preview= node->preview; int xsize, ysize; - int color_manage= rd->color_mgt_flag & R_COLOR_MANAGEMENT; + int profile_from= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB; + int predivide= 0; + int dither= 0; unsigned char *rect; if(preview && stackbuf) { @@ -633,10 +635,9 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) /* convert to byte for preview */ rect= MEM_callocN(sizeof(unsigned char)*4*xsize*ysize, "bNodePreview.rect"); - if(color_manage) - floatbuf_to_srgb_byte(cbuf->rect, rect, 0, xsize, 0, ysize, xsize); - else - floatbuf_to_byte(cbuf->rect, rect, 0, xsize, 0, ysize, xsize); + IMB_buffer_byte_from_float(rect, cbuf->rect, + 4, dither, IB_PROFILE_SRGB, profile_from, predivide, + xsize, ysize, xsize, xsize); free_compbuf(cbuf); if(stackbuf_use!=stackbuf) |