diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-23 19:04:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-23 19:12:55 +0400 |
commit | 8ddc3d148e9d8e55a5d64774e0a2a430f92bba59 (patch) | |
tree | f37fd847465a4d90ff6dbdf23d7f0ca186f3c5e5 /source/blender | |
parent | 82c90a44c2db62fbf14dd23481ae2f43b4322667 (diff) |
Cleanup: simplify check to draw syntax
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 95802be9ef9..e2351c8360f 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -373,6 +373,7 @@ static const char *txt_utf8_forward_columns(const char *str, int columns, int *p static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w, const char *format, int skip) { + const bool use_syntax = (st->showsyntax && format); FlattenString fs; int basex, lines; int i, wrap, end, max, columns, padding; /* column */ @@ -406,7 +407,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* Draw the visible portion of text on the overshot line */ for (a = fstart, ma = mstart; ma < mend; a++, ma += BLI_str_utf8_size_safe(str + ma)) { - if (st->showsyntax && format) { + if (use_syntax) { if (fmt_prev != format[a]) format_draw_color(fmt_prev = format[a]); } x += text_font_draw_character_utf8(st, x, y, str + ma); @@ -428,7 +429,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* Draw the remaining text */ for (a = fstart, ma = mstart; str[ma] && y > 0; a++, ma += BLI_str_utf8_size_safe(str + ma)) { - if (st->showsyntax && format) { + if (use_syntax) { if (fmt_prev != format[a]) format_draw_color(fmt_prev = format[a]); } @@ -442,6 +443,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w static void text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int x, int y, const char *format) { + const bool use_syntax = (st->showsyntax && format); FlattenString fs; int columns, size, n, w = 0, padding, amount = 0; const char *in = NULL; @@ -474,7 +476,7 @@ static void text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int x, x += st->cwidth * padding; - if (st->showsyntax && format) { + if (use_syntax) { int a, str_shift = 0; char fmt_prev = 0xff; |