[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13807] trunk/blender/source/blender: Fix for [#8303] stamp gives wrong file name when using unsaved files

Campbell Barton ideasman42 at gmail.com
Fri Feb 22 00:19:07 CET 2008


Revision: 13807
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13807
Author:   campbellbarton
Date:     2008-02-22 00:19:06 +0100 (Fri, 22 Feb 2008)

Log Message:
-----------
Fix for [#8303] stamp gives wrong file name when using unsaved files
Also made alpha color work with OpenGL render caused by buf_rectfill_area not working on char rect's.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/imbuf/intern/rectop.c

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2008-02-21 21:28:54 UTC (rev 13806)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2008-02-21 23:19:06 UTC (rev 13807)
@@ -906,8 +906,13 @@
 #endif /* WIN32 */
 	
 	if (G.scene->r.stamp & R_STAMP_FILENAME) {
-		if (do_prefix)		sprintf(stamp_data->file, "File %s", G.sce);
-		else				sprintf(stamp_data->file, "%s", G.sce);
+		if (G.relbase_valid) {
+			if (do_prefix)		sprintf(stamp_data->file, "File %s", G.sce);
+			else				sprintf(stamp_data->file, "%s", G.sce);
+		} else {
+			if (do_prefix)		strcpy(stamp_data->file, "File <untitled>");
+			else				strcpy(stamp_data->file, "<untitled>");
+		}
 		stamp_data->note[0] = '\0';
 	} else {
 		stamp_data->file[0] = '\0';

Modified: trunk/blender/source/blender/imbuf/intern/rectop.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/rectop.c	2008-02-21 21:28:54 UTC (rev 13806)
+++ trunk/blender/source/blender/imbuf/intern/rectop.c	2008-02-21 23:19:06 UTC (rev 13807)
@@ -525,7 +525,9 @@
 void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2)
 {
 	int i, j;
-	float a, ai;
+	float a; /* alpha */
+	float ai; /* alpha inverted */
+	float aich; /* alpha, inverted, ai/255.0 - Convert char to float at the same time */
 	if ((!rect && !rectf) || (!col) || col[3]==0.0)
 		return;
 	
@@ -541,7 +543,7 @@
 	
 	a = col[3];
 	ai = 1-a;
-	
+	aich = ai/255.0f;
 
 	if (rect) {
 		unsigned char *pixel; 
@@ -566,9 +568,9 @@
 						pixel[1] = chg;
 						pixel[2] = chb;
 					} else {
-						pixel[0] = (char)(fr + ((float)pixel[0]*ai));
-						pixel[1] = (char)(fg + ((float)pixel[1]*ai));
-						pixel[2] = (char)(fb + ((float)pixel[2]*ai));
+						pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
+						pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
+						pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f);
 					}
 				}
 			}





More information about the Bf-blender-cvs mailing list