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:
Diffstat (limited to 'source/blender/editors/space_graph/graph_draw.c')
-rw-r--r--source/blender/editors/space_graph/graph_draw.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 5f118151a33..dfc59a79c49 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -493,20 +493,18 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu)
/* Helper func - just draw the F-Curve by sampling the visible region
* (for drawing curves with modifiers). */
static void draw_fcurve_curve(
- bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, View2DGrid *grid, unsigned int pos)
+ bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, unsigned int pos)
{
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
float samplefreq;
float stime, etime;
float unitFac, offset;
- float dx, dy;
short mapping_flag = ANIM_get_normalization_flags(ac);
int i, n;
/* when opening a blend file on a different sized screen or while dragging the toolbar this can
* happen best just bail out in this case. */
- UI_view2d_grid_size(grid, &dx, &dy);
- if (dx <= 0.0f) {
+ if (UI_view2d_scale_get_x(v2d) <= 0.0f) {
return;
}
@@ -529,11 +527,11 @@ static void draw_fcurve_curve(
* loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value
* chosen here is just the coarsest value which still looks reasonable...
*/
- /* grid->dx represents the number of 'frames' between gridlines,
- * but we divide by U.v2d_min_gridsize to get pixels-steps */
+
/* TODO: perhaps we should have 1.0 frames
* as upper limit so that curves don't get too distorted? */
- samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize);
+ float pixels_per_sample = 1.5f;
+ samplefreq = pixels_per_sample / UI_view2d_scale_get_x(v2d);
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
/* Low Precision = coarse lower-bound clamping
@@ -1043,8 +1041,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_region_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves(
- bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, View2DGrid *grid, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -1131,7 +1128,7 @@ void graph_draw_curves(
/* draw a curve affected by modifiers or only allowed to have integer values
* by sampling it at various small-intervals over the visible region
*/
- draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid, shdr_pos);
+ draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos);
}
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
/* just draw curve based on defined data (i.e. no modifiers) */
@@ -1140,7 +1137,7 @@ void graph_draw_curves(
draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, shdr_pos);
}
else {
- draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid, shdr_pos);
+ draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos);
}
}
else if (fcu->fpt) {