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:
authorAntonio Vazquez <blendergit@gmail.com>2020-03-12 21:38:51 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-03-12 21:39:10 +0300
commitc1290a1d1f6beee8e60990d888fdb0a4d1a34e17 (patch)
treea7a39836a34494613c0e6009b1ae487827ccb4ab /source/blender/editors/gpencil/gpencil_vertex_paint.c
parent649fdc793851a214f54c9ecdaae4c120c4bd11c9 (diff)
GPencil: Fix color management in Vertex Paint tools
The brush is using sRGB and need to be Linear
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_vertex_paint.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_vertex_paint.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c
index c730d1b493e..9cdea22d45e 100644
--- a/source/blender/editors/gpencil/gpencil_vertex_paint.c
+++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c
@@ -104,6 +104,7 @@ typedef struct tGP_BrushVertexpaintData {
bGPdata *gpd;
Brush *brush;
+ float linear_color[3];
eGPDvertex_brush_Flag flag;
eGP_Vertex_SelectMaskFlag mask;
@@ -444,7 +445,7 @@ static bool brush_tint_apply(tGP_BrushVertexpaintData *gso,
/* Premult. */
mul_v3_fl(pt->vert_color, pt->vert_color[3]);
/* "Alpha over" blending. */
- interp_v3_v3v3(pt->vert_color, pt->vert_color, brush->rgb, inf);
+ interp_v3_v3v3(pt->vert_color, pt->vert_color, gso->linear_color, inf);
pt->vert_color[3] = pt->vert_color[3] * (1.0 - inf) + inf;
/* Un-premult. */
if (pt->vert_color[3] > 0.0f) {
@@ -463,7 +464,7 @@ static bool brush_tint_apply(tGP_BrushVertexpaintData *gso,
/* Premult. */
mul_v3_fl(gps->vert_color_fill, gps->vert_color_fill[3]);
/* "Alpha over" blending. */
- interp_v3_v3v3(gps->vert_color_fill, gps->vert_color_fill, brush->rgb, inf_fill);
+ interp_v3_v3v3(gps->vert_color_fill, gps->vert_color_fill, gso->linear_color, inf_fill);
gps->vert_color_fill[3] = gps->vert_color_fill[3] * (1.0 - inf_fill) + inf_fill;
/* Un-premult. */
if (gps->vert_color_fill[3] > 0.0f) {
@@ -483,7 +484,7 @@ static bool brush_replace_apply(tGP_BrushVertexpaintData *gso, bGPDstroke *gps,
/* Apply color to Stroke point. */
if (GPENCIL_TINT_VERTEX_COLOR_STROKE(brush)) {
- copy_v3_v3(pt->vert_color, brush->rgb);
+ copy_v3_v3(pt->vert_color, gso->linear_color);
/* If not mix color, full replace. */
if (pt->vert_color[3] == 0.0f) {
pt->vert_color[3] = 1.0f;
@@ -492,7 +493,7 @@ static bool brush_replace_apply(tGP_BrushVertexpaintData *gso, bGPDstroke *gps,
/* Apply color to Fill area (all with same color and factor). */
if (GPENCIL_TINT_VERTEX_COLOR_FILL(brush)) {
- copy_v3_v3(gps->vert_color_fill, brush->rgb);
+ copy_v3_v3(gps->vert_color_fill, gso->linear_color);
/* If not mix color, full replace. */
if (gps->vert_color_fill[3] == 0.0f) {
gps->vert_color_fill[3] = 1.0f;
@@ -731,6 +732,7 @@ static bool gp_vertexpaint_brush_init(bContext *C, wmOperator *op)
op->customdata = gso;
gso->brush = paint->brush;
+ srgb_to_linearrgb_v3_v3(gso->linear_color, gso->brush->rgb);
BKE_curvemapping_initialize(gso->brush->curve);
gso->is_painting = false;