diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 20 |
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); } |