Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 0e123d872fe..f8d0957f70d 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -79,29 +79,24 @@ void GPU_render_text(MTFace *tface, int mode,
const char *textstr, int textlen, unsigned int *col,
float *v1, float *v2, float *v3, float *v4, int glattrib)
{
- if (mode & TF_BMFONT) {
- Image* ima;
- int characters, index, character;
+ if ((mode & TF_BMFONT) && (textlen>0) && tface->tpage) {
+ Image* ima = (Image*)tface->tpage;
+ int index, character;
float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
float advance_tab;
-
/* multiline */
- float line_start= 0.0f, line_height;
+ float line_start= 0.0f, line_height;
+
if (v4)
line_height= MAX4(v1[1], v2[1], v3[1], v4[2]) - MIN4(v1[1], v2[1], v3[1], v4[2]);
else
line_height= MAX3(v1[1], v2[1], v3[1]) - MIN3(v1[1], v2[1], v3[1]);
line_height *= 1.2; /* could be an option? */
/* end multiline */
-
- characters = textlen;
- ima = (Image*)tface->tpage;
- if (ima == NULL)
- characters = 0;
-
- // color has been set
+
+ /* color has been set */
if (tface->mode & TF_OBCOL)
col= NULL;
else if (!col)
@@ -116,7 +111,7 @@ void GPU_render_text(MTFace *tface, int mode,
advance_tab= advance * 4; /* tab width could also be an option */
- for (index = 0; index < characters; index++) {
+ for (index = 0; index < textlen; index++) {
float uv[4][2];
// lets calculate offset stuff