diff options
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index f448a281cfc..caa4a6e31f3 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -71,10 +71,15 @@ /* 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, 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(); gpuScale2f(1.0f / xscale, 1.0f); @@ -91,15 +96,11 @@ 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); } - const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - int slen = UI_fontstyle_string_width(fstyle, numstr) - 1; + slen = UI_fontstyle_string_width(fstyle, numstr) - 1; /* get starting coordinates for drawing */ - 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); + x = cfra * xscale; + y = 0.9f * U.widget_unit; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -110,7 +111,6 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const immUnbindProgram(); /* 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); |