[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55358] trunk/blender/source/blender: Fix "can't paint" bug no.1, painting with black on image editor did not

Antony Riakiotakis kalast at gmail.com
Sun Mar 17 19:09:09 CET 2013


Revision: 55358
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55358
Author:   psy-fi
Date:     2013-03-17 18:09:09 +0000 (Sun, 17 Mar 2013)
Log Message:
-----------
Fix "can't paint" bug no.1, painting with black on image editor did not
paint. Was own regression when optimizing colour operations. I will not
use an alpha bit mask since it may run into portability issues with byte
order.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_brush.h
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c
    trunk/blender/source/blender/imbuf/IMB_imbuf_types.h
    trunk/blender/source/blender/imbuf/intern/rectop.c

Modified: trunk/blender/source/blender/blenkernel/BKE_brush.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-03-17 17:32:45 UTC (rev 55357)
+++ trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-03-17 18:09:09 UTC (rev 55358)
@@ -72,7 +72,7 @@
 float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3],
                               float rgba[4], const int thread, struct ImagePool *pool);
 float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2],
-                              float rgba[4], struct ImagePool *pool);
+                              float rgba[4]);
 void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
                          struct ImBuf **imbuf, int use_color_correction);
 

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-03-17 17:32:45 UTC (rev 55357)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-03-17 18:09:09 UTC (rev 55358)
@@ -563,7 +563,7 @@
 
 
 /* Brush Sampling for 2D brushes. when we unify the brush systems this will be necessarily a separate function */
-float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], struct ImagePool *pool)
+float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4])
 {
 	UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
 	MTex *mtex = &brush->mtex;
@@ -598,7 +598,7 @@
 		co[1] = y + brush->mtex.ofs[1];
 		co[2] = 0.0f;
 
-		hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, pool);
+		hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, NULL);
 
 		if (hasrgb) {
 			rgba[0] = tr;
@@ -660,15 +660,15 @@
 					dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 				}
 				else if (texfall == 1) {
-					BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, dstf);
 				}
 				else if (texfall == 2) {
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					mul_v3_v3v3(dstf, rgba, brush_rgb);
 					dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 				}
 				else {
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					copy_v3_v3(dstf, brush_rgb);
 					dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 				}
@@ -695,11 +695,11 @@
 					dst[3] = FTOCHAR(alpha_f);
 				}
 				else if (texfall == 1) {
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					rgba_float_to_uchar(dst, rgba);
 				}
 				else if (texfall == 2) {
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					mul_v3_v3(rgba, brush->rgb);
 					alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 
@@ -708,7 +708,7 @@
 					dst[3] = FTOCHAR(alpha_f);
 				}
 				else {
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 
 					dst[0] = crgb[0];

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-03-17 17:32:45 UTC (rev 55357)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-03-17 18:09:09 UTC (rev 55358)
@@ -235,7 +235,7 @@
 					xy[0] = x + xoff;
 					xy[1] = y + yoff;
 
-					BKE_brush_sample_tex_2D(scene, brush, xy, tf, NULL);
+					BKE_brush_sample_tex_2D(scene, brush, xy, tf);
 				}
 
 				bf[0] = tf[0] * mf[0];
@@ -266,7 +266,7 @@
 					xy[0] = x + xoff;
 					xy[1] = y + yoff;
 
-					BKE_brush_sample_tex_2D(scene, brush, xy, rgba, NULL);
+					BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
 					rgba_float_to_uchar(t, rgba);
 				}
 

Modified: trunk/blender/source/blender/imbuf/IMB_imbuf_types.h
===================================================================
--- trunk/blender/source/blender/imbuf/IMB_imbuf_types.h	2013-03-17 17:32:45 UTC (rev 55357)
+++ trunk/blender/source/blender/imbuf/IMB_imbuf_types.h	2013-03-17 18:09:09 UTC (rev 55358)
@@ -179,7 +179,6 @@
  * Note that the lower 11 bits is used for storing custom flags
  */
 #define IB_CUSTOM_FLAGS_MASK 0x7ff
-#define IB_ALPHA_MASK 0xff
 
 #define PNG				(1 << 30)
 #define TGA				(1 << 28)

Modified: trunk/blender/source/blender/imbuf/intern/rectop.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/rectop.c	2013-03-17 17:32:45 UTC (rev 55357)
+++ trunk/blender/source/blender/imbuf/intern/rectop.c	2013-03-17 18:09:09 UTC (rev 55358)
@@ -517,7 +517,7 @@
 				dr = drect;
 				sr = srect;
 				for (x = width; x > 0; x--, dr++, sr++) {
-					if (*sr & IB_ALPHA_MASK)
+					if (((char *)sr)[3])
 						func((char *)dr, (char *)dr, (char *)sr, ((char *)sr)[3]);
 				}
 




More information about the Bf-blender-cvs mailing list