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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-04-14 12:08:10 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-04-14 12:10:00 +0400
commite6ff0ec73da5fa82873ea75f4915b7cf8410c454 (patch)
treef91f3e2cf83622b48c01edc8d22d1c527c81b53c /source
parent0d38f21cbc004a2aa8b4a944aaf068d83e75a197 (diff)
Fix T39704: Texture painting fails with different float image working space
This was rather a TODO item related on supporting the proper painting color space, but added a small tweaks which will make things working for now in most of the situation (assuming the default view of display is ivnertible, as it is to be expected to be anyway). Shouldn't give much overhead since the conversion processors are cached in the color management code. And for the note: no, projection painting does not requite such a tweak because viewport works in sRGB space anyway.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 19f2673d96a..c15d481b01e 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -233,6 +233,9 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size)
Scene *scene = painter->scene;
Brush *brush = painter->brush;
+ const char *display_device = scene->display_settings.display_device;
+ struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
+
rctf tex_mapping = painter->tex_mapping;
rctf mask_mapping = painter->mask_mapping;
struct ImagePool *pool = painter->pool;
@@ -258,8 +261,9 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size)
if (brush->imagepaint_tool == PAINT_TOOL_DRAW) {
copy_v3_v3(brush_rgb, brush->rgb);
- if (use_color_correction)
- srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb);
+ if (use_color_correction) {
+ IMB_colormanagement_display_to_scene_linear_v3(brush_rgb, display);
+ }
}
else {
brush_rgb[0] = 1.0f;
@@ -278,7 +282,7 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size)
BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
/* TODO(sergey): Support texture paint color space. */
if (!use_float) {
- linearrgb_to_srgb_v3_v3(rgba, rgba);
+ IMB_colormanagement_display_to_scene_linear_v3(rgba, display);
}
mul_v3_v3(rgba, brush_rgb);
}
@@ -326,6 +330,9 @@ static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf,
Scene *scene = painter->scene;
Brush *brush = painter->brush;
+ const char *display_device = scene->display_settings.display_device;
+ struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
+
rctf tex_mapping = painter->tex_mapping;
rctf mask_mapping = painter->mask_mapping;
struct ImagePool *pool = painter->pool;
@@ -348,8 +355,9 @@ static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf,
if (brush->imagepaint_tool == PAINT_TOOL_DRAW) {
copy_v3_v3(brush_rgb, brush->rgb);
- if (use_color_correction)
- srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb);
+ if (use_color_correction) {
+ IMB_colormanagement_display_to_scene_linear_v3(brush_rgb, display);
+ }
}
else {
brush_rgb[0] = 1.0f;
@@ -369,7 +377,7 @@ static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf,
BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
/* TODO(sergey): Support texture paint color space. */
if (!use_float) {
- linearrgb_to_srgb_v3_v3(rgba, rgba);
+ IMB_colormanagement_display_to_scene_linear_v3(rgba, display);
}
mul_v3_v3(rgba, brush_rgb);
}