diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-13 02:50:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-13 02:50:21 +0400 |
commit | 10f631094c158ff2fdb49fc9236e699fb91ed015 (patch) | |
tree | deb75dc6d040ad4bae45994d34bf5e150e3b29a1 /source/blender/blenkernel/intern | |
parent | 866f986898cf6c35e8b4d5190853e453a3eb1714 (diff) |
fix [#32126] STAMP: Setting a background color causes color flicker
when rendering the sequencer can output float or char buffers which stamp wasn't accounting for.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 4bd47f391af..5f6fedc553c 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1476,6 +1476,10 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec float h_fixed; const int mono = blf_mono_font_render; // XXX + /* this could be an argument if we want to operate on non linear float imbuf's + * for now though this is only used for renders which use scene settings */ + const int do_color_management = (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) != 0; + #define BUFF_MARGIN_X 2 #define BUFF_MARGIN_Y 1 @@ -1491,7 +1495,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec /* set before return */ BLF_size(mono, scene->r.stamp_font_id, 72); - BLF_buffer(mono, rectf, rect, width, height, channels, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) != 0); + BLF_buffer(mono, rectf, rect, width, height, channels, do_color_management); BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0); pad = BLF_width_max(mono); @@ -1508,7 +1512,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y -= h; /* also a little of space to the background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); /* and draw the text. */ @@ -1525,7 +1529,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y -= h; /* and space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); @@ -1541,7 +1545,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y -= h; /* and space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); @@ -1557,7 +1561,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y -= h; /* and space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); @@ -1572,7 +1576,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_width_and_height(mono, stamp_data.marker, &w, &h); h = h_fixed; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); /* and pad the text. */ @@ -1588,7 +1592,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_width_and_height(mono, stamp_data.time, &w, &h); h = h_fixed; /* extra space for background */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); /* and pad the text. */ @@ -1603,7 +1607,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_width_and_height(mono, stamp_data.frame, &w, &h); h = h_fixed; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); /* and pad the text. */ @@ -1618,7 +1622,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_width_and_height(mono, stamp_data.camera, &w, &h); h = h_fixed; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); BLF_draw_buffer(mono, stamp_data.camera); @@ -1631,7 +1635,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h = h_fixed; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); BLF_draw_buffer(mono, stamp_data.cameralens); @@ -1644,7 +1648,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec x = width - w - 2; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); /* and pad the text. */ @@ -1660,7 +1664,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec y = height - h; /* extra space for background. */ - buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, + buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management, x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y); BLF_position(mono, x, y + y_ofs, 0.0); |