[Bf-blender-cvs] [11cf1eb] master: Fix first part of T44627, locking alpha should happen in straight space for float images or we get inconsistent premultiplied values.
Antony Riakiotakis
noreply at git.blender.org
Thu May 7 11:42:59 CEST 2015
Commit: 11cf1ebdd1fa81a475bc13d72fa1b20d7b479191
Author: Antony Riakiotakis
Date: Thu May 7 11:42:09 2015 +0200
Branches: master
https://developer.blender.org/rB11cf1ebdd1fa81a475bc13d72fa1b20d7b479191
Fix first part of T44627, locking alpha should happen in straight space
for float images or we get inconsistent premultiplied values.
===================================================================
M source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 70127d0..6f34db4 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];
}
More information about the Bf-blender-cvs
mailing list