[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29790] trunk/blender/source/blender/ editors/sculpt_paint/paint_image.c: image re-projection wasnt changing alpha values.
Campbell Barton
ideasman42 at gmail.com
Tue Jun 29 15:20:11 CEST 2010
Revision: 29790
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29790
Author: campbellbarton
Date: 2010-06-29 15:20:11 +0200 (Tue, 29 Jun 2010)
Log Message:
-----------
image re-projection wasnt changing alpha values.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-06-29 12:33:25 UTC (rev 29789)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-06-29 13:20:11 UTC (rev 29790)
@@ -3552,16 +3552,18 @@
cp[3]= mfac*cp1[3] + fac*cp2[3];
}
-static void blend_color_mix_rgb(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
+static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
{
/* this and other blending modes previously used >>8 instead of /255. both
are not equivalent (>>8 is /256), and the former results in rounding
errors that can turn colors black fast after repeated blending */
const int mfac= 255-fac;
+ const int alpha= cp1[3] + ((fac * cp2[3]) / 255);
cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
+ cp[3]= alpha > 255 ? 255 : alpha;
}
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
@@ -3732,7 +3734,8 @@
bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
if(projPixel->newColor.ch[3]) {
mask = ((float)projPixel->mask)/65535.0f;
- blend_color_mix_rgb(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (mask*projPixel->newColor.ch[3]));
+ blend_color_mix_accum(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (mask*projPixel->newColor.ch[3]));
+
}
}
}
More information about the Bf-blender-cvs
mailing list