Refactor: resolution_scale in graph_draw.cc #111037

Merged
Christoph Lendenfeld merged 5 commits from ChrisLend/blender:reafactor_graph_draw_res_scale into main 2023-08-17 14:25:25 +02:00
1 changed files with 1 additions and 0 deletions
Showing only changes of commit c159a8021d - Show all commits

View File

@ -1006,6 +1006,7 @@ static void add_extrapolation_point_right(FCurve *fcu,
curve_vertices.append(vertex_position);
}
/** Calculate how many points are needed per unit of the visible range of the View2D based on its
nathanvegdahl marked this conversation as resolved Outdated

Maybe:

Calculate how many sample points per unit (in both dimensions) are needed to draw curves with adequate resolution in the given View2D, based on the size of the view's units in pixels.

That way it's a little clearer what kind of points we're talking about and for what purpose.

I'm also realizing that it feels to me like the variable points_per_pixel should either be a function parameter, or it shouldn't exist at all (i.e. just substitute 1.0, and then the function becomes pixels_per_unit()). Maybe that's too much for what's supposed to be a tiny PR, though.

Maybe: > Calculate how many sample points per unit (in both dimensions) are needed to draw curves with adequate resolution in the given View2D, based on the size of the view's units in pixels. That way it's a little clearer what kind of points we're talking about and for what purpose. I'm also realizing that it feels to me like the variable `points_per_pixel` should either be a function parameter, or it shouldn't exist at all (i.e. just substitute 1.0, and then the function becomes `pixels_per_unit()`). Maybe that's too much for what's supposed to be a tiny PR, though.

Good point changing it to pixels_per_unit
That is actually what I need for #110788 as well

The points_per_pixel I'd like to keep but that can be moved into the calculate_bezt_draw_resolution function
If I set that to 1 it would make 4 times the amount of points impacting performance

Yes the patch bloated a bit, but it is for good reason :)

Good point changing it to `pixels_per_unit` That is actually what I need for #110788 as well The `points_per_pixel` I'd like to keep but that can be moved into the `calculate_bezt_draw_resolution` function If I set that to 1 it would make 4 times the amount of points impacting performance Yes the patch bloated a bit, but it is for good reason :)
* pixel size. */
static blender::float2 calculate_points_per_unit(View2D *v2d)