Blender  V2.93
view2d_draw.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <float.h>
25 #include <limits.h>
26 #include <math.h>
27 #include <string.h>
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "DNA_scene_types.h"
32 #include "DNA_userdef_types.h"
33 
34 #include "BLI_array.h"
35 #include "BLI_math.h"
36 #include "BLI_rect.h"
37 #include "BLI_string.h"
38 #include "BLI_timecode.h"
39 #include "BLI_utildefines.h"
40 
41 #include "GPU_immediate.h"
42 #include "GPU_matrix.h"
43 #include "GPU_state.h"
44 
45 #include "WM_api.h"
46 
47 #include "BLF_api.h"
48 
49 #include "UI_interface.h"
50 #include "UI_view2d.h"
51 
52 #include "interface_intern.h"
53 
54 /* Compute display grid resolution
55  ********************************************************/
56 
57 #define MIN_MAJOR_LINE_DISTANCE (U.v2d_min_gridsize * UI_DPI_FAC)
58 
59 static float select_major_distance(const float *possible_distances,
60  uint amount,
61  float pixel_width,
62  float view_width)
63 {
64  BLI_assert(amount >= 1);
65 
66  if (IS_EQF(view_width, 0.0f)) {
67  return possible_distances[0];
68  }
69 
70  const float pixels_per_view_unit = pixel_width / view_width;
71 
72  for (uint i = 0; i < amount; i++) {
73  const float distance = possible_distances[i];
74  if (pixels_per_view_unit * distance >= MIN_MAJOR_LINE_DISTANCE) {
75  return distance;
76  }
77  }
78  return possible_distances[amount - 1];
79 }
80 
81 static const float discrete_value_scales[] = {
82  1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000};
83 
84 static const float continuous_value_scales[] = {0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2,
85  5, 10, 20, 50, 100, 200, 500, 1000,
86  2000, 5000, 10000, 20000, 50000, 100000};
87 
89 {
92  BLI_rcti_size_x(&v2d->mask),
93  BLI_rctf_size_x(&v2d->cur));
94 }
95 
96 static float view2d_major_step_x__continuous(const View2D *v2d)
97 {
100  BLI_rcti_size_x(&v2d->mask),
101  BLI_rctf_size_x(&v2d->cur));
102 }
103 
104 static float view2d_major_step_y__continuous(const View2D *v2d)
105 {
108  BLI_rcti_size_y(&v2d->mask),
109  BLI_rctf_size_y(&v2d->cur));
110 }
111 
112 static float view2d_major_step_x__time(const View2D *v2d, const Scene *scene)
113 {
114  const double fps = FPS;
115 
116  float *possible_distances = NULL;
117  BLI_array_staticdeclare(possible_distances, 32);
118 
119  for (uint step = 1; step < fps; step *= 2) {
120  BLI_array_append(possible_distances, step);
121  }
122  BLI_array_append(possible_distances, fps);
123  BLI_array_append(possible_distances, 2 * fps);
124  BLI_array_append(possible_distances, 5 * fps);
125  BLI_array_append(possible_distances, 10 * fps);
126  BLI_array_append(possible_distances, 30 * fps);
127  BLI_array_append(possible_distances, 60 * fps);
128  BLI_array_append(possible_distances, 2 * 60 * fps);
129  BLI_array_append(possible_distances, 5 * 60 * fps);
130  BLI_array_append(possible_distances, 10 * 60 * fps);
131  BLI_array_append(possible_distances, 30 * 60 * fps);
132  BLI_array_append(possible_distances, 60 * 60 * fps);
133 
134  float distance = select_major_distance(possible_distances,
135  BLI_array_len(possible_distances),
136  BLI_rcti_size_x(&v2d->mask),
137  BLI_rctf_size_x(&v2d->cur));
138 
139  BLI_array_free(possible_distances);
140  return distance;
141 }
142 
143 /* Draw parallel lines
144  ************************************/
145 
146 typedef struct ParallelLinesSet {
147  float offset;
148  float distance;
150 
152  float region_start,
153  float region_end,
154  float *r_first,
155  uint *r_steps)
156 {
157  if (region_start >= region_end) {
158  *r_first = 0;
159  *r_steps = 0;
160  return;
161  }
162 
163  BLI_assert(lines->distance > 0);
164  BLI_assert(region_start <= region_end);
165 
166  *r_first = ceilf((region_start - lines->offset) / lines->distance) * lines->distance +
167  lines->offset;
168 
169  if (region_start <= *r_first && region_end >= *r_first) {
170  *r_steps = MAX2(0, floorf((region_end - *r_first) / lines->distance)) + 1;
171  }
172  else {
173  *r_steps = 0;
174  }
175 }
176 
180 static void draw_parallel_lines(const ParallelLinesSet *lines,
181  const rctf *rect,
182  const rcti *rect_mask,
183  const uchar color[3],
184  char direction)
185 {
186  float first;
187  uint steps, steps_max;
188 
189  if (direction == 'v') {
190  get_parallel_lines_draw_steps(lines, rect->xmin, rect->xmax, &first, &steps);
191  steps_max = BLI_rcti_size_x(rect_mask);
192  }
193  else {
194  BLI_assert(direction == 'h');
195  get_parallel_lines_draw_steps(lines, rect->ymin, rect->ymax, &first, &steps);
196  steps_max = BLI_rcti_size_y(rect_mask);
197  }
198 
199  if (steps == 0) {
200  return;
201  }
202 
203  if (UNLIKELY(steps >= steps_max)) {
204  /* Note that we could draw a solid color,
205  * however this flickers because of numeric instability when zoomed out. */
206  return;
207  }
208 
211 
212  if (U.pixelsize > 1.0f) {
213  float viewport[4];
214  GPU_viewport_size_get_f(viewport);
215 
217  immUniform2fv("viewportSize", &viewport[2]);
218  /* -1.0f offset here is because the line is too fat due to the builtin anti-aliasing.
219  * TODO make a variant or a uniform to toggle it off. */
220  immUniform1f("lineWidth", U.pixelsize - 1.0f);
221  }
222  else {
224  }
225  immUniformColor3ubv(color);
227 
228  if (direction == 'v') {
229  for (uint i = 0; i < steps; i++) {
230  const float xpos = first + i * lines->distance;
231  immVertex2f(pos, xpos, rect->ymin);
232  immVertex2f(pos, xpos, rect->ymax);
233  }
234  }
235  else {
236  for (uint i = 0; i < steps; i++) {
237  const float ypos = first + i * lines->distance;
238  immVertex2f(pos, rect->xmin, ypos);
239  immVertex2f(pos, rect->xmax, ypos);
240  }
241  }
242 
243  immEnd();
245 }
246 
247 static void view2d_draw_lines_internal(const View2D *v2d,
248  const ParallelLinesSet *lines,
249  const uchar color[3],
250  char direction)
251 {
254  draw_parallel_lines(lines, &v2d->cur, &v2d->mask, color, direction);
256 }
257 
258 static void view2d_draw_lines(const View2D *v2d,
259  float major_distance,
260  bool display_minor_lines,
261  char direction)
262 {
263  {
264  uchar major_color[3];
265  UI_GetThemeColor3ubv(TH_GRID, major_color);
266  ParallelLinesSet major_lines;
267  major_lines.distance = major_distance;
268  major_lines.offset = 0;
269  view2d_draw_lines_internal(v2d, &major_lines, major_color, direction);
270  }
271 
272  if (display_minor_lines) {
273  uchar minor_color[3];
274  UI_GetThemeColorShade3ubv(TH_GRID, 16, minor_color);
275  ParallelLinesSet minor_lines;
276  minor_lines.distance = major_distance;
277  minor_lines.offset = major_distance / 2.0f;
278  view2d_draw_lines_internal(v2d, &minor_lines, minor_color, direction);
279  }
280 }
281 
282 /* Scale indicator text drawing
283  **************************************************/
284 
285 typedef void (*PositionToString)(
286  void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str);
287 
288 static void draw_horizontal_scale_indicators(const ARegion *region,
289  const View2D *v2d,
290  float distance,
291  const rcti *rect,
293  void *to_string_data,
294  int colorid)
295 {
296  if (UI_view2d_scale_get_x(v2d) <= 0.0f) {
297  return;
298  }
299 
300  float start;
301  uint steps;
302  {
303  ParallelLinesSet lines;
304  lines.distance = distance;
305  lines.offset = 0;
307  UI_view2d_region_to_view_x(v2d, rect->xmin),
308  UI_view2d_region_to_view_x(v2d, rect->xmax),
309  &start,
310  &steps);
311  const uint steps_max = BLI_rcti_size_x(&v2d->mask);
312  if (UNLIKELY(steps >= steps_max)) {
313  return;
314  }
315  }
316 
319 
320  const int font_id = BLF_default();
321  UI_FontThemeColor(font_id, colorid);
322 
324 
325  const float ypos = rect->ymin + 4 * UI_DPI_FAC;
326  const float xmin = rect->xmin;
327  const float xmax = rect->xmax;
328 
329  for (uint i = 0; i < steps; i++) {
330  const float xpos_view = start + i * distance;
331  const float xpos_region = UI_view2d_view_to_region_x(v2d, xpos_view);
332  char text[32];
333  to_string(to_string_data, xpos_view, distance, sizeof(text), text);
334  const float text_width = BLF_width(font_id, text, strlen(text));
335 
336  if (xpos_region - text_width / 2.0f >= xmin && xpos_region + text_width / 2.0f <= xmax) {
337  BLF_draw_default_ascii(xpos_region - text_width / 2.0f, ypos, 0.0f, text, sizeof(text));
338  }
339  }
340 
342 
344 }
345 
346 static void draw_vertical_scale_indicators(const ARegion *region,
347  const View2D *v2d,
348  float distance,
349  float display_offset,
350  const rcti *rect,
352  void *to_string_data,
353  int colorid)
354 {
355  if (UI_view2d_scale_get_y(v2d) <= 0.0f) {
356  return;
357  }
358 
359  float start;
360  uint steps;
361  {
362  ParallelLinesSet lines;
363  lines.distance = distance;
364  lines.offset = 0;
366  UI_view2d_region_to_view_y(v2d, rect->ymin),
367  UI_view2d_region_to_view_y(v2d, rect->ymax),
368  &start,
369  &steps);
370  const uint steps_max = BLI_rcti_size_y(&v2d->mask);
371  if (UNLIKELY(steps >= steps_max)) {
372  return;
373  }
374  }
375 
378 
379  const int font_id = BLF_default();
380  UI_FontThemeColor(font_id, colorid);
381 
382  BLF_enable(font_id, BLF_ROTATION);
383  BLF_rotation(font_id, M_PI_2);
384 
386 
387  const float xpos = rect->xmax - 2.0f * UI_DPI_FAC;
388  const float ymin = rect->ymin;
389  const float ymax = rect->ymax;
390 
391  for (uint i = 0; i < steps; i++) {
392  const float ypos_view = start + i * distance;
393  const float ypos_region = UI_view2d_view_to_region_y(v2d, ypos_view + display_offset);
394  char text[32];
395  to_string(to_string_data, ypos_view, distance, sizeof(text), text);
396  const float text_width = BLF_width(font_id, text, strlen(text));
397 
398  if (ypos_region - text_width / 2.0f >= ymin && ypos_region + text_width / 2.0f <= ymax) {
399  BLF_draw_default_ascii(xpos, ypos_region - text_width / 2.0f, 0.0f, text, sizeof(text));
400  }
401  }
402 
404  BLF_disable(font_id, BLF_ROTATION);
405 
407 }
408 
410  void *UNUSED(user_data), float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
411 {
412  BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
413 }
414 
416  void *user_data, float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
417 {
418  const Scene *scene = (const Scene *)user_data;
419 
420  const int brevity_level = 0;
422  r_str, max_len, brevity_level, v2d_pos / (float)FPS, FPS, U.timecode_style);
423 }
424 
426  void *UNUSED(user_data), float v2d_pos, float v2d_step, uint max_len, char *r_str)
427 {
428  if (v2d_step >= 1.0f) {
429  BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
430  }
431  else if (v2d_step >= 0.1f) {
432  BLI_snprintf(r_str, max_len, "%.1f", v2d_pos);
433  }
434  else if (v2d_step >= 0.01f) {
435  BLI_snprintf(r_str, max_len, "%.2f", v2d_pos);
436  }
437  else {
438  BLI_snprintf(r_str, max_len, "%.3f", v2d_pos);
439  }
440 }
441 
442 /* Grid Resolution API
443  **************************************************/
444 
446  const struct Scene *scene,
447  bool display_seconds)
448 {
449  if (display_seconds) {
450  return view2d_major_step_x__time(v2d, scene);
451  }
453 }
454 
456 {
458 }
459 
460 /* Line Drawing API
461  **************************************************/
462 
464 {
465  const uint major_line_distance = view2d_major_step_x__discrete(v2d);
466  view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v');
467 }
468 
470 {
471  const float major_line_distance = view2d_major_step_x__continuous(v2d);
472  view2d_draw_lines(v2d, major_line_distance, true, 'v');
473 }
474 
476 {
477  const float major_line_distance = view2d_major_step_y__continuous(v2d);
478  view2d_draw_lines(v2d, major_line_distance, true, 'h');
479 }
480 
482 {
483  const float major_line_distance = view2d_major_step_x__time(v2d, scene);
484  view2d_draw_lines(v2d, major_line_distance, major_line_distance > 1, 'v');
485 }
486 
488  const Scene *scene,
489  bool display_seconds)
490 {
491  if (display_seconds) {
493  }
494  else {
496  }
497 }
498 
500  const Scene *scene,
501  bool display_seconds)
502 {
503  if (display_seconds) {
505  }
506  else {
508  }
509 }
510 
511 /* Scale indicator text drawing API
512  **************************************************/
513 
515  const View2D *v2d,
516  const rcti *rect,
517  int colorid)
518 {
519  const float number_step = view2d_major_step_x__discrete(v2d);
521  region, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid);
522 }
523 
525  const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
526 {
527  const float step = view2d_major_step_x__time(v2d, scene);
529  region, v2d, step, rect, view_to_string__time, (void *)scene, colorid);
530 }
531 
532 static void UI_view2d_draw_scale_x__values(const ARegion *region,
533  const View2D *v2d,
534  const rcti *rect,
535  int colorid)
536 {
537  const float step = view2d_major_step_x__continuous(v2d);
538  draw_horizontal_scale_indicators(region, v2d, step, rect, view_to_string__value, NULL, colorid);
539 }
540 
542  const View2D *v2d,
543  const rcti *rect,
544  int colorid)
545 {
546  const float step = view2d_major_step_y__continuous(v2d);
548  region, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid);
549 }
550 
552  const View2D *v2d,
553  const rcti *rect,
554  int colorid)
555 {
557  region, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid);
558 }
559 
561  const struct View2D *v2d,
562  const struct rcti *rect,
563  const struct Scene *scene,
564  bool display_seconds,
565  int colorid)
566 {
567  if (display_seconds) {
568  UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
569  }
570  else {
571  UI_view2d_draw_scale_x__discrete_values(region, v2d, rect, colorid);
572  }
573 }
574 
576  const struct View2D *v2d,
577  const struct rcti *rect,
578  const struct Scene *scene,
579  bool display_seconds,
580  int colorid)
581 {
582  if (display_seconds) {
583  UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
584  }
585  else {
586  UI_view2d_draw_scale_x__values(region, v2d, rect, colorid);
587  }
588 }
float BLF_width(int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:723
int BLF_default(void)
Definition: blf_default.c:55
void BLF_disable(int fontid, int option)
Definition: blf.c:283
void BLF_rotation(int fontid, float angle)
Definition: blf.c:801
#define BLF_ROTATION
Definition: BLF_api.h:269
void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
Definition: blf_default.c:82
void BLF_batch_draw_begin(void)
Definition: blf.c:470
void BLF_enable(int fontid, int option)
Definition: blf.c:274
void BLF_batch_draw_end(void)
Definition: blf.c:483
A (mainly) macro array library.
#define BLI_array_append(arr, item)
Definition: BLI_array.h:104
#define BLI_array_staticdeclare(arr, maxstatic)
Definition: BLI_array.h:69
#define BLI_array_len(arr)
Definition: BLI_array.h:74
#define BLI_array_free(arr)
Definition: BLI_array.h:116
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define M_PI_2
Definition: BLI_math_base.h:41
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:161
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:165
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
size_t BLI_timecode_string_from_time(char *str, const size_t maxncpy, const int brevity_level, const float time_seconds, const double scene_fps, const short timecode_style) ATTR_NONNULL()
Definition: timecode.c:51
#define ARRAY_SIZE(arr)
#define UNUSED(x)
#define MAX2(a, b)
#define UNLIKELY(x)
#define IS_EQF(a, b)
#define FPS
void immUniform2fv(const char *name, const float data[2])
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat(void)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:156
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:149
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
Definition: GPU_shader.h:223
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:171
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:279
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define UI_DPI_FAC
Definition: UI_interface.h:309
@ TH_GRID
Definition: UI_resources.h:84
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
Definition: resources.c:1350
void UI_FontThemeColor(int fontid, int colorid)
Definition: resources.c:1156
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
Definition: resources.c:1235
float UI_view2d_view_to_region_x(const struct View2D *v2d, float x)
float UI_view2d_view_to_region_y(const struct View2D *v2d, float y)
void UI_view2d_view_ortho(const struct View2D *v2d)
float UI_view2d_scale_get_y(const struct View2D *v2d)
float UI_view2d_region_to_view_x(const struct View2D *v2d, float x)
Definition: view2d.c:1659
float UI_view2d_scale_get_x(const struct View2D *v2d)
float UI_view2d_region_to_view_y(const struct View2D *v2d, float y)
Definition: view2d.c:1664
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
void * user_data
uint pos
#define ceilf(x)
#define floorf(x)
format
Definition: logImageCore.h:47
std::string to_string(const T &n)
static const int steps
Definition: sky_nishita.cpp:28
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
ccl_device_inline float distance(const float2 &a, const float2 &b)
static void draw_vertical_scale_indicators(const ARegion *region, const View2D *v2d, float distance, float display_offset, const rcti *rect, PositionToString to_string, void *to_string_data, int colorid)
Definition: view2d_draw.c:346
static void draw_horizontal_scale_indicators(const ARegion *region, const View2D *v2d, float distance, const rcti *rect, PositionToString to_string, void *to_string_data, int colorid)
Definition: view2d_draw.c:288
void UI_view2d_draw_lines_x__values(const View2D *v2d)
Definition: view2d_draw.c:469
static void view_to_string__value(void *UNUSED(user_data), float v2d_pos, float v2d_step, uint max_len, char *r_str)
Definition: view2d_draw.c:425
static float select_major_distance(const float *possible_distances, uint amount, float pixel_width, float view_width)
Definition: view2d_draw.c:59
static void UI_view2d_draw_scale_x__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.c:532
#define MIN_MAJOR_LINE_DISTANCE
Definition: view2d_draw.c:57
void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, const Scene *scene, bool display_seconds)
Definition: view2d_draw.c:499
static float view2d_major_step_x__continuous(const View2D *v2d)
Definition: view2d_draw.c:96
static void view2d_draw_lines(const View2D *v2d, float major_distance, bool display_minor_lines, char direction)
Definition: view2d_draw.c:258
static void view_to_string__time(void *user_data, float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
Definition: view2d_draw.c:415
struct ParallelLinesSet ParallelLinesSet
float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d, const struct Scene *scene, bool display_seconds)
Definition: view2d_draw.c:445
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d)
Definition: view2d_draw.c:455
void UI_view2d_draw_lines_y__values(const View2D *v2d)
Definition: view2d_draw.c:475
static const float discrete_value_scales[]
Definition: view2d_draw.c:81
static float view2d_major_step_x__time(const View2D *v2d, const Scene *scene)
Definition: view2d_draw.c:112
void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, bool display_seconds, int colorid)
Definition: view2d_draw.c:560
void UI_view2d_draw_lines_x__discrete_time(const View2D *v2d, const Scene *scene)
Definition: view2d_draw.c:481
static void UI_view2d_draw_scale_x__discrete_time(const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
Definition: view2d_draw.c:524
void UI_view2d_draw_lines_x__discrete_frames_or_seconds(const View2D *v2d, const Scene *scene, bool display_seconds)
Definition: view2d_draw.c:487
void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, bool display_seconds, int colorid)
Definition: view2d_draw.c:575
void UI_view2d_draw_scale_y__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.c:541
static void view2d_draw_lines_internal(const View2D *v2d, const ParallelLinesSet *lines, const uchar color[3], char direction)
Definition: view2d_draw.c:247
static void view_to_string__frame_number(void *UNUSED(user_data), float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
Definition: view2d_draw.c:409
void UI_view2d_draw_scale_y__block(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.c:551
static void UI_view2d_draw_scale_x__discrete_values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid)
Definition: view2d_draw.c:514
static float view2d_major_step_y__continuous(const View2D *v2d)
Definition: view2d_draw.c:104
static uint view2d_major_step_x__discrete(const View2D *v2d)
Definition: view2d_draw.c:88
void UI_view2d_draw_lines_x__discrete_values(const View2D *v2d)
Definition: view2d_draw.c:463
static void draw_parallel_lines(const ParallelLinesSet *lines, const rctf *rect, const rcti *rect_mask, const uchar color[3], char direction)
Definition: view2d_draw.c:180
static const float continuous_value_scales[]
Definition: view2d_draw.c:84
static void get_parallel_lines_draw_steps(const ParallelLinesSet *lines, float region_start, float region_end, float *r_first, uint *r_steps)
Definition: view2d_draw.c:151
void(* PositionToString)(void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str)
Definition: view2d_draw.c:285
void wmOrtho2_region_pixelspace(const ARegion *region)
Definition: wm_subwindow.c:120