Cleanup: pass large arguments by const reference instead of by value

This commit is contained in:
Campbell Barton
2025-07-20 15:23:07 +10:00
parent e5947bdf63
commit df1da0fbdd
5 changed files with 11 additions and 10 deletions

View File

@@ -640,7 +640,7 @@ static float3x2 get_stroke_to_texture_matrix(const float uv_rotation,
return texture_matrix;
}
static float4x3 expand_4x2_mat(float4x2 strokemat)
static float4x3 expand_4x2_mat(const float4x2 &strokemat)
{
float4x3 strokemat4x3 = float4x3(strokemat);

View File

@@ -194,7 +194,7 @@ class View {
{
}
float4x4 winmat_polygon_offset(float4x4 winmat, float offset)
float4x4 winmat_polygon_offset(const float4x4 &winmat, float offset)
{
float view_dist = dist;
/* Special exception for orthographic camera:
@@ -203,12 +203,13 @@ class View {
view_dist = 1.0f / max_ff(fabsf(winmat[0][0]), fabsf(winmat[1][1]));
}
winmat[3][2] -= GPU_polygon_offset_calc(winmat.ptr(), view_dist, offset);
return winmat;
float4x4 result = winmat;
result[3][2] -= GPU_polygon_offset_calc(winmat.ptr(), view_dist, offset);
return result;
}
/* Return unit offset to apply to `gl_Position.z`. To be scaled depending on purpose. */
float polygon_offset_factor(float4x4 winmat)
float polygon_offset_factor(const float4x4 &winmat)
{
float view_dist = dist;
/* Special exception for orthographic camera:

View File

@@ -1548,8 +1548,8 @@ float radius_from_input_sample(const RegionView3D *rv3d,
const ARegion *region,
const Brush *brush,
const float pressure,
const float3 location,
const float4x4 to_world,
const float3 &location,
const float4x4 &to_world,
const BrushGpencilSettings *settings)
{
float radius = brush_radius_at_location(rv3d, region, brush, location, to_world);

View File

@@ -342,8 +342,8 @@ float radius_from_input_sample(const RegionView3D *rv3d,
const ARegion *region,
const Brush *brush,
float pressure,
float3 location,
float4x4 to_world,
const float3 &location,
const float4x4 &to_world,
const BrushGpencilSettings *settings);
wmOperatorStatus grease_pencil_draw_operator_invoke(bContext *C,
wmOperator *op,

View File

@@ -1662,7 +1662,7 @@ static void get_intersecting_edges(Vector<int> *r_intersecting_edges,
* from the origin to the plane in the normal direction.
*/
static bool is_plane(const Mesh *mesh,
float4x4 transform,
const float4x4 &transform,
float3 *r_normal,
float *r_origin_offset)
{