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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-05-12 23:01:23 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-05-12 23:01:23 +0400
commitdf746390020f4484c76d95e094f2533a84bf436c (patch)
treed40cdb0daf27e9d07621651c7accfa0fc0d41ce2 /source/blender/imbuf
parent87b308fc23f4b8889c07d1df9f20df7d5f113d63 (diff)
Speedup for rendered viewport for blender internal
Display code was a bottleneck here, so made it so render result draw follows Image Draw settings.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h5
-rw-r--r--source/blender/imbuf/intern/colormanagement.c24
2 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 314daed00dd..7399b8554aa 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -93,6 +93,11 @@ struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, int save_a
const struct ColorManagedDisplaySettings *display_settings,
struct ImageFormatData *image_format_data);
+void IMB_colormanagement_buffer_make_display_space(float *buffer, unsigned char *display_buffer,
+ int width, int height, int channels, float dither,
+ const struct ColorManagedViewSettings *view_settings,
+ const struct ColorManagedDisplaySettings *display_settings);
+
/* ** Public display buffers interfaces ** */
void IMB_colormanagement_display_settings_from_ctx(const struct bContext *C,
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index c127a7b719a..78eb5eeb65b 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1863,6 +1863,30 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int
return colormanaged_ibuf;
}
+void IMB_colormanagement_buffer_make_display_space(float *buffer, unsigned char *display_buffer,
+ int width, int height, int channels, float dither,
+ const ColorManagedViewSettings *view_settings,
+ const ColorManagedDisplaySettings *display_settings)
+{
+ ColormanageProcessor *cm_processor;
+ size_t float_buffer_size = width * height * channels * sizeof(float);
+ float *display_buffer_float = MEM_mallocN(float_buffer_size, "byte_buffer_make_display_space");
+
+ memcpy(display_buffer_float, buffer, float_buffer_size);
+
+ cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
+
+ processor_transform_apply_threaded(display_buffer_float, width, height, channels,
+ cm_processor, TRUE);
+
+ IMB_buffer_byte_from_float(display_buffer, display_buffer_float,
+ channels, dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
+ TRUE, width, height, width, width);
+
+ MEM_freeN(display_buffer_float);
+ IMB_colormanagement_processor_free(cm_processor);
+}
+
static void imbuf_verify_float(ImBuf *ibuf)
{
/* multiple threads could request for display buffer at once and in case