diff options
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 7651989c2df..f115618c13b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -402,7 +402,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) * Ensure View2D rects remain in a viable configuration * 'cur' is not allowed to be: larger than max, smaller than min, or outside of 'tot' */ -// XXX pre2.5 -> this used to be called test_view2d() +/* XXX pre2.5 -> this used to be called test_view2d() */ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize) { float totwidth, totheight, curwidth, curheight, width, height; @@ -994,7 +994,7 @@ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resiz printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d\n", (void *)v2d, width, - height); // XXX temp debug info + height); /* XXX temp debug info */ } return; } @@ -1046,53 +1046,6 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height) UI_view2d_totRect_set_resize(v2d, width, height, false); } -bool UI_view2d_tab_set(View2D *v2d, int tab) -{ - float default_offset[2] = {0.0f, 0.0f}; - float *offset, *new_offset; - bool changed = false; - - /* if tab changed, change offset */ - if (tab != v2d->tab_cur && v2d->tab_offset) { - if (tab < v2d->tab_num) { - offset = &v2d->tab_offset[tab * 2]; - } - else { - offset = default_offset; - } - - v2d->cur.xmax += offset[0] - v2d->cur.xmin; - v2d->cur.xmin = offset[0]; - - v2d->cur.ymin += offset[1] - v2d->cur.ymax; - v2d->cur.ymax = offset[1]; - - /* validation should happen in subsequent totRect_set */ - - changed = true; - } - - /* resize array if needed */ - if (tab >= v2d->tab_num) { - new_offset = MEM_callocN(sizeof(float) * (tab + 1) * 2, "view2d tab offset"); - - if (v2d->tab_offset) { - memcpy(new_offset, v2d->tab_offset, sizeof(float) * v2d->tab_num * 2); - MEM_freeN(v2d->tab_offset); - } - - v2d->tab_offset = new_offset; - v2d->tab_num = tab + 1; - } - - /* set current tab and offset */ - v2d->tab_cur = tab; - v2d->tab_offset[2 * tab + 0] = v2d->cur.xmin; - v2d->tab_offset[2 * tab + 1] = v2d->cur.ymax; - - return changed; -} - void UI_view2d_zoom_cache_reset(void) { /* TODO(sergey): This way we avoid threading conflict with sequencer rendering @@ -1103,7 +1056,7 @@ void UI_view2d_zoom_cache_reset(void) return; } /* While scaling we can accumulate fonts at many sizes (~20 or so). - * Not an issue with embedded font, but can use over 500Mb with i18n ones! See [#38244]. */ + * Not an issue with embedded font, but can use over 500Mb with i18n ones! See T38244. */ /* note: only some views draw text, we could check for this case to avoid clearning cache */ BLF_cache_clear(); @@ -1341,7 +1294,9 @@ void UI_view2d_multi_grid_draw( immBeginAtMost(GPU_PRIM_LINES, vertex_count); for (int level = 0; level < totlevels; level++) { - UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color); + /* Blend the background color (colorid) with the grid color, to avoid either too low contrast + * or high contrast grid lines. This only has an effect if colorid != TH_GRID. */ + UI_GetThemeColorBlendShade3ubv(colorid, TH_GRID, 0.25f, offset, grid_line_color); int i = (int)(v2d->cur.xmin / lstep); if (v2d->cur.xmin > 0.0f) { @@ -1382,7 +1337,8 @@ void UI_view2d_multi_grid_draw( } /* X and Y axis */ - UI_GetThemeColorShade3ubv(colorid, -18 + ((totlevels - 1) * -6), grid_line_color); + UI_GetThemeColorBlendShade3ubv( + colorid, TH_GRID, 0.5f, -18 + ((totlevels - 1) * -6), grid_line_color); immAttrSkip(color); immVertex2f(pos, 0.0f, v2d->cur.ymin); |