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:
authorAntony Riakiotakis <kalast@gmail.com>2015-05-07 12:42:09 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-05-07 12:42:37 +0300
commit11cf1ebdd1fa81a475bc13d72fa1b20d7b479191 (patch)
tree664411ccc80761fe9f10655ce44ce6adf3481d85
parent0e9b210595e3a1f07e079b9f3e5e3abb9a2039a9 (diff)
Fix first part of T44627, locking alpha should happen in straight space
for float images or we get inconsistent premultiplied values.
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 70127d0d425..6f34db4e424 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4664,7 +4664,14 @@ static void *do_projectpaint_thread(void *ph_v)
}
if (lock_alpha) {
- if (is_floatbuf) projPixel->pixel.f_pt[3] = projPixel->origColor.f_pt[3];
+ if (is_floatbuf) {
+ /* slightly more involved case since floats are in premultiplied space we need
+ * to make sure alpha is consistent, see T44627 */
+ float rgb_straight[4];
+ premul_to_straight_v4_v4(rgb_straight, projPixel->pixel.f_pt);
+ rgb_straight[3] = projPixel->origColor.f_pt[3];
+ straight_to_premul_v4_v4(projPixel->pixel.f_pt, rgb_straight);
+ }
else projPixel->pixel.ch_pt[3] = projPixel->origColor.ch_pt[3];
}
@@ -4833,7 +4840,14 @@ static void *do_projectpaint_thread(void *ph_v)
}
if (lock_alpha) {
- if (is_floatbuf) projPixel->pixel.f_pt[3] = projPixel->origColor.f_pt[3];
+ if (is_floatbuf) {
+ /* slightly more involved case since floats are in premultiplied space we need
+ * to make sure alpha is consistent, see T44627 */
+ float rgb_straight[4];
+ premul_to_straight_v4_v4(rgb_straight, projPixel->pixel.f_pt);
+ rgb_straight[3] = projPixel->origColor.f_pt[3];
+ straight_to_premul_v4_v4(projPixel->pixel.f_pt, rgb_straight);
+ }
else projPixel->pixel.ch_pt[3] = projPixel->origColor.ch_pt[3];
}