[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42691] branches/soc-2011-onion-uv-tools/ source/blender/gpu/intern/gpu_draw.c: small changes from review remarks no.

Antony Riakiotakis kalast at gmail.com
Sat Dec 17 16:05:45 CET 2011


Revision: 42691
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42691
Author:   psy-fi
Date:     2011-12-17 15:05:35 +0000 (Sat, 17 Dec 2011)
Log Message:
-----------
small changes from review remarks no. 2

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/gpu/intern/gpu_draw.c

Modified: branches/soc-2011-onion-uv-tools/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/gpu/intern/gpu_draw.c	2011-12-17 14:23:38 UTC (rev 42690)
+++ branches/soc-2011-onion-uv-tools/source/blender/gpu/intern/gpu_draw.c	2011-12-17 15:05:35 UTC (rev 42691)
@@ -414,9 +414,9 @@
 	unsigned int *tilerect= NULL, *scalerect= NULL, *rect= NULL;
 	float *frectrow, *ftilerectrow, *ftilerect= NULL;
 	float *frect = NULL, *fscalerect = NULL;
-	float *color_corrected_frect = NULL;
+	float *srgb_frect = NULL;
 	short texwindx, texwindy, texwinsx, texwinsy;
-	/*flag to determine whether high resolution format is used*/
+	/* flag to determine whether high resolution format is used */
 	int useHighPrecisionTex = FALSE, doColorConversion = FALSE;
 
 	/* initialize tile mode and number of repeats */
@@ -470,8 +470,8 @@
 	if (ibuf->rect_float){
 		if(U.high_bit_depth_tex)
 		{
-			/*Use high precision textures. This is relatively harmless because OpenGL gives us
-			a high precision format only if it is available*/
+			/* Use high precision textures. This is relatively harmless because OpenGL gives us
+			   a high precision format only if it is available */
 			useHighPrecisionTex = TRUE;
 		}
 		if(ibuf->profile == IB_PROFILE_LINEAR_RGB){
@@ -519,9 +519,9 @@
 			if(useHighPrecisionTex){
 				/* We may also need a color corrected float image. Dithering will not apply since it's high precision */
 				if(doColorConversion){
-					color_corrected_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor");
-					IMB_float_color_corrected_from_float_rect(ibuf, color_corrected_frect);
-					frect= color_corrected_frect + texwinsy*ibuf->x + texwinsx;
+					srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor");
+					IMB_float_color_corrected_from_float_rect(ibuf, srgb_frect);
+					frect= srgb_frect + texwinsy*ibuf->x + texwinsx;
 				}else{
 					frect= ibuf->rect_float + texwinsy*ibuf->x + texwinsx;
 				}
@@ -541,8 +541,8 @@
 			if(useHighPrecisionTex){
 				/* We may also need a color corrected float image. Dithering will not apply since it's high precision */
 				if(doColorConversion){
-					frect = color_corrected_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*color_corrected_frect)*4, "floar_buf_col_cor");
-					IMB_float_color_corrected_from_float_rect(ibuf, color_corrected_frect);
+					frect = srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*srgb_frect)*4, "floar_buf_col_cor");
+					IMB_float_color_corrected_from_float_rect(ibuf, srgb_frect);
 				}else{
 					frect= ibuf->rect_float;
 				}
@@ -587,7 +587,7 @@
 	}
 
 	/* scale if not a power of two. This is not strictly necessary for newer 
-	GPUs (OpenGL version >= 2.0)since they support non-power-of-two-textures */
+	   GPUs (OpenGL version >= 2.0)since they support non-power-of-two-textures */
 	if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
 		rectw= smaller_pow2_limit(rectw);
 		recth= smaller_pow2_limit(recth);
@@ -617,7 +617,7 @@
 		if(useHighPrecisionTex)
 			glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA16,  rectw, recth, 0, GL_RGBA, GL_FLOAT, frect);			
 		else
-		glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+			glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 	}
@@ -625,7 +625,7 @@
 		if(useHighPrecisionTex)
 			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA16, rectw, recth, GL_RGBA, GL_FLOAT, frect);
 		else
-		gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 
@@ -646,8 +646,8 @@
 		MEM_freeN(scalerect);
 	if (fscalerect)
 		MEM_freeN(fscalerect);
-	if(color_corrected_frect)
-		MEM_freeN(color_corrected_frect);
+	if(srgb_frect)
+		MEM_freeN(srgb_frect);
 	return *bind;
 }
 
@@ -792,7 +792,7 @@
 				GL_FLOAT, ibuf->rect_float);
 		}else{
 			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
-					GL_UNSIGNED_BYTE, ibuf->rect);
+				GL_UNSIGNED_BYTE, ibuf->rect);
 		}
 
 		glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);




More information about the Bf-blender-cvs mailing list