[Bf-blender-cvs] [a8dc3f4] blender2.8: BLF: make blurry text an optional (disabled) feature

Mike Erwin noreply at git.blender.org
Sun Oct 16 08:09:44 CEST 2016


Commit: a8dc3f4596ef5aed70ceeaa7e3029cb782a0f0ef
Author: Mike Erwin
Date:   Sat Oct 15 19:40:41 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBa8dc3f4596ef5aed70ceeaa7e3029cb782a0f0ef

BLF: make blurry text an optional (disabled) feature

While trying to simplify text drawing, noticed no Blender code uses the blur feature. Hopefully scripts don't use it!

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

M	source/blender/blenfont/BLF_api.h
M	source/blender/blenfont/intern/blf.c
M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenfont/intern/blf_glyph.c
M	source/blender/blenfont/intern/blf_internal_types.h
M	source/blender/python/generic/blf_py_api.c

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

diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 1f38d64..3da0434 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -34,6 +34,9 @@
 
 #include "BLI_compiler_attrs.h"
 
+/* enable this only if needed (unused circa 2016) */
+#define BLF_BLUR_ENABLE 0
+
 struct rctf;
 struct ColorManagedDisplay;
 struct ResultBLF;
@@ -144,7 +147,10 @@ void BLF_rotation(int fontid, float angle);
 void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax);
 void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax);
 void BLF_wordwrap(int fontid, int wrap_width);
+
+#if BLF_BLUR_ENABLE
 void BLF_blur(int fontid, int size);
+#endif
 
 void BLF_enable(int fontid, int option);
 void BLF_disable(int fontid, int option);
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 7ddc540..f42057a 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -455,6 +455,7 @@ void BLF_size(int fontid, int size, int dpi)
 	}
 }
 
+#if BLF_BLUR_ENABLE
 void BLF_blur(int fontid, int size)
 {
 	FontBLF *font = blf_get(fontid);
@@ -463,6 +464,7 @@ void BLF_blur(int fontid, int size)
 		font->blur = size;
 	}
 }
+#endif
 
 void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
 {
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 42717e6..cac3b86 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -951,7 +951,9 @@ static void blf_font_fill(FontBLF *font)
 	font->size = 0;
 	BLI_listbase_clear(&font->cache);
 	font->glyph_cache = NULL;
+#if BLF_BLUR_ENABLE
 	font->blur = 0;
+#endif
 	font->max_tex_size = -1;
 
 	font->buf_info.fbuf = NULL;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 3d96260..a74210c 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -490,6 +490,7 @@ void blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 		}
 	}
 
+#if BLF_BLUR_ENABLE
 	switch (font->blur) {
 		case 3:
 			blf_texture3_draw(font->orig_col, g->uv, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
@@ -501,4 +502,8 @@ void blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 			immAttrib4fv(BLF_COLOR_ID, font->orig_col);
 			blf_texture_draw(g->uv, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
 	}
+#else
+	immAttrib4fv(BLF_COLOR_ID, font->orig_col);
+	blf_texture_draw(g->uv, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+#endif
 }
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 0fac576..26d7fd3 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -175,8 +175,10 @@ typedef struct FontBLF {
 	/* angle in radians. */
 	float angle;
 	
+#if BLF_BLUR_ENABLE
 	/* blur: 3 or 5 large kernel */
 	int blur;
+#endif
 
 	/* shadow level. */
 	int shadow;
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 69f1e29..02bd1fd 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -114,6 +114,7 @@ static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
 }
 
 
+#if BLF_BLUR_ENABLE
 PyDoc_STRVAR(py_blf_blur_doc,
 ".. function:: blur(fontid, radius)\n"
 "\n"
@@ -135,6 +136,7 @@ static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
 
 	Py_RETURN_NONE;
 }
+#endif
 
 
 PyDoc_STRVAR(py_blf_draw_doc,
@@ -418,7 +420,9 @@ static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
 /*----------------------------MODULE INIT-------------------------*/
 static PyMethodDef BLF_methods[] = {
 	{"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc},
+#if BLF_BLUR_ENABLE
 	{"blur", (PyCFunction) py_blf_blur, METH_VARARGS, py_blf_blur_doc},
+#endif
 	{"clipping", (PyCFunction) py_blf_clipping, METH_VARARGS, py_blf_clipping_doc},
 	{"word_wrap", (PyCFunction) py_blf_word_wrap, METH_VARARGS, py_blf_word_wrap_doc},
 	{"disable", (PyCFunction) py_blf_disable, METH_VARARGS, py_blf_disable_doc},




More information about the Bf-blender-cvs mailing list