diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-06-08 11:15:38 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-06-08 11:15:38 +0400 |
commit | c330f399ca7adc14108786e86d6a662b09739f6d (patch) | |
tree | da3f25ebc7c7e8d16c759f7590b910c9a4c7a969 /source/blender/editors/space_text/text_draw.c | |
parent | 87242d657c5ce5be772322da9cee43c2ecdbb808 (diff) |
warning fixes
GPU_immediate.h: casting a pointer directly to a GLboolean and a complaint about how I wrote GPU_SAFE_RETURN
text_draw.c: uninitialized and unused variables. also some style changes
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 02160b586ba..65fd952211f 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -138,7 +138,8 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in) fs->accum = fs->fixedaccum; fs->len = sizeof(fs->fixedbuf); - for (r = 0, i = 0; *in; r++) { + i = 0; + for (r = 0; *in; r++) { if (*in == '\t') { i = st->tabnumber - (total % st->tabnumber); total += i; @@ -712,7 +713,6 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w for (i = 0, mi = 0; str[mi]; i++, mi += BLI_str_utf8_size(str + mi)) { if (i - start >= max) { - int str_shift = 0; int ox; char last_format; char buffer[BLF_DRAW_STR_DUMMY_MAX]; @@ -778,13 +778,13 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* Draw the remaining text */ if (y > 0) { - int str_shift = 0; int ox; char last_format; char buffer[BLF_DRAW_STR_DUMMY_MAX]; size_t len = 0; + const int showsyntax = st->showsyntax && format; - if (st->showsyntax && format) { + if (showsyntax) { last_format = format[start]; format_draw_color(format[start]); } @@ -796,7 +796,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w for (a = start; str[ma]; a++) { size_t char_len; - if (st->showsyntax && format && last_format != format[a]) { + if (showsyntax && last_format != format[a]) { memcpy(buffer, str + ma - len, len); buffer[len] = '\0'; text_font_draw(st, ox, y, buffer); @@ -1642,11 +1642,15 @@ static void draw_cursor(SpaceText *st, ARegion *ar) } y -= froml * st->lheight; - gpuSingleRecti(GL_QUADS, x + fromc * st->cwidth - 1, y, ar->winx, y - st->lheight); y -= st->lheight; - for (i = froml + 1; i < tol; i++) - gpuSingleRecti(GL_QUADS, x - 4, y, ar->winx, y - st->lheight), y -= st->lheight; + gpuSingleRecti(GL_QUADS, x + fromc * st->cwidth - 1, y, ar->winx, y - st->lheight); + y -= st->lheight; + + for (i = froml + 1; i < tol; i++) { + gpuSingleRecti(GL_QUADS, x - 4, y, ar->winx, y - st->lheight); + y -= st->lheight; + } - gpuSingleRecti(GL_QUADS, x - 4, y, x + toc * st->cwidth, y - st->lheight); y -= st->lheight; + gpuSingleRecti(GL_QUADS, x - 4, y, x + toc * st->cwidth, y - st->lheight); } } else { @@ -1689,7 +1693,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar) glDisable(GL_BLEND); } } - + if (!hidden) { /* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */ x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; |