[Bf-blender-cvs] [8d8d193] master: Cleanup: use bool for mipmap args

Campbell Barton noreply at git.blender.org
Mon Apr 27 17:19:23 CEST 2015


Commit: 8d8d1939fab72cee068be81dac84679cac42cee6
Author: Campbell Barton
Date:   Tue Apr 28 01:03:28 2015 +1000
Branches: master
https://developer.blender.org/rB8d8d1939fab72cee068be81dac84679cac42cee6

Cleanup: use bool for mipmap args

===================================================================

M	source/blender/gpu/GPU_draw.h
M	source/blender/gpu/intern/gpu_draw.c

===================================================================

diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 20aa491..845ae9d 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -104,11 +104,11 @@ void GPU_render_text(struct MTFace *tface, int mode,
 /* Mipmap settings
  * - these will free textures on changes */
 
-void GPU_set_mipmap(int mipmap);
-int GPU_get_mipmap(void);
-void GPU_set_linear_mipmap(int linear);
-int GPU_get_linear_mipmap(void);
-void GPU_paint_set_mipmap(int mipmap);
+void GPU_set_mipmap(bool mipmap);
+bool GPU_get_mipmap(void);
+void GPU_set_linear_mipmap(bool linear);
+bool GPU_get_linear_mipmap(void);
+void GPU_paint_set_mipmap(bool mipmap);
 
 /* Anisotropic filtering settings
  * - these will free textures on changes */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7d41746..a31e90f 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -239,8 +239,8 @@ static struct GPUTextureState {
 	int curtileYRep, tileYRep;
 	Image *ima, *curima;
 
-	int domipmap, linearmipmap;
-	int texpaint; /* store this so that new images created while texture painting won't be set to mipmapped */
+	bool domipmap, linearmipmap;
+	bool texpaint; /* store this so that new images created while texture painting won't be set to mipmapped */
 
 	int alphablend;
 	float anisotropic;
@@ -281,33 +281,33 @@ static void gpu_generate_mipmap(GLenum target)
 		glDisable(target);
 }
 
-void GPU_set_mipmap(int mipmap)
+void GPU_set_mipmap(bool mipmap)
 {
-	if (GTS.domipmap != (mipmap != 0)) {
+	if (GTS.domipmap != mipmap) {
 		GPU_free_images();
-		GTS.domipmap = mipmap != 0;
+		GTS.domipmap = mipmap;
 	}
 }
 
-void GPU_set_linear_mipmap(int linear)
+void GPU_set_linear_mipmap(bool linear)
 {
-	if (GTS.linearmipmap != (linear != 0)) {
+	if (GTS.linearmipmap != linear) {
 		GPU_free_images();
-		GTS.linearmipmap = linear != 0;
+		GTS.linearmipmap = linear;
 	}
 }
 
-int GPU_get_mipmap(void)
+bool GPU_get_mipmap(void)
 {
 	return GTS.domipmap && !GTS.texpaint;
 }
 
-int GPU_get_linear_mipmap(void)
+bool GPU_get_linear_mipmap(void)
 {
 	return GTS.linearmipmap;
 }
 
-static GLenum gpu_get_mipmap_filter(int mag)
+static GLenum gpu_get_mipmap_filter(bool mag)
 {
 	/* linearmipmap is off by default *when mipmapping is off,
 	 * use unfiltered display */
@@ -931,7 +931,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
  * temporary disabling/enabling mipmapping on all images for quick texture
  * updates with glTexSubImage2D. images that didn't change don't have to be
  * re-uploaded to OpenGL */
-void GPU_paint_set_mipmap(int mipmap)
+void GPU_paint_set_mipmap(bool mipmap)
 {
 	Image *ima;




More information about the Bf-blender-cvs mailing list