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:
authorMike Erwin <significant.bit@gmail.com>2017-04-04 22:39:38 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-04 22:40:21 +0300
commit125ce644f28dccea67ad5bdada0013eba8caafbe (patch)
treea182689b2b57d4a8dd1b419ba4b5ccf54b4603de /source/blender/editors/animation/anim_draw.c
parentdb0f67f46454fd0bfeb886d3e61227b65fbc6ac1 (diff)
cleanup
I started cleaning up UI_view2d_scale_get where the y scale was unused, then got carried away... - for loop scope - declare variables closer to where they are used - move early exits closer to function start - unsigned --> unsigned int
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r--source/blender/editors/animation/anim_draw.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 5d357e2f93e..f448a281cfc 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -71,17 +71,12 @@
/* Draw current frame number in a little green box beside the current frame indicator */
static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time)
{
- const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned char col[4];
- float xscale, yscale, x, y;
char numstr[32] = " t"; /* t is the character to start replacing from */
- int slen;
/* because the frame number text is subject to the same scaling as the contents of the view */
+ float xscale;
+ UI_view2d_scale_get(v2d, &xscale, NULL);
gpuPushMatrix();
- UI_view2d_scale_get(v2d, &xscale, &yscale);
gpuScale2f(1.0f / xscale, 1.0f);
/* get timecode string
@@ -96,11 +91,15 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
BLI_timecode_string_from_time_seconds(&numstr[4], sizeof(numstr) - 4, 1, cfra);
}
- slen = UI_fontstyle_string_width(fstyle, numstr) - 1;
+ const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
+ int slen = UI_fontstyle_string_width(fstyle, numstr) - 1;
/* get starting coordinates for drawing */
- x = cfra * xscale;
- y = 0.9f * U.widget_unit;
+ float x = cfra * xscale;
+ float y = 0.9f * U.widget_unit;
+
+ VertexFormat *format = immVertexFormat();
+ unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -110,7 +109,8 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
immRectf(pos, x, y, x + slen, y + 0.75f * U.widget_unit);
immUnbindProgram();
- /* draw current frame number - black text */
+ /* draw current frame number */
+ unsigned char col[4];
UI_GetThemeColor4ubv(TH_TEXT, col);
UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr, col);