More const correctness

This commit is contained in:
KitsuneAlex 2024-05-03 23:46:44 +02:00
parent ad0aef556d
commit f82ab9bc2b
No known key found for this signature in database
GPG Key ID: 6B0CE864BB69B7D0
2 changed files with 12 additions and 12 deletions

View File

@ -262,15 +262,15 @@ MSDF_API int msdf_shape_validate(msdf_shape_handle shape, int* result) {
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
MSDF_API int msdf_shape_bound(msdf_shape_handle shape, msdf_bounds_t* bounds) { MSDF_API int msdf_shape_bound(msdf_shape_const_handle shape, msdf_bounds_t* bounds) {
if(shape == nullptr || bounds == nullptr) { if(shape == nullptr || bounds == nullptr) {
return MSDF_ERR_INVALID_ARG; return MSDF_ERR_INVALID_ARG;
} }
reinterpret_cast<msdfgen::Shape*>(shape)->bound(bounds->l, bounds->b, bounds->r, bounds->t); reinterpret_cast<const msdfgen::Shape*>(shape)->bound(bounds->l, bounds->b, bounds->r, bounds->t);
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
MSDF_API int msdf_shape_bound_miters(msdf_shape_handle shape, MSDF_API int msdf_shape_bound_miters(msdf_shape_const_handle shape,
msdf_bounds_t* bounds, msdf_bounds_t* bounds,
const double border, const double border,
const double miter_limit, const double miter_limit,
@ -278,7 +278,7 @@ MSDF_API int msdf_shape_bound_miters(msdf_shape_handle shape,
if(shape == nullptr || bounds == nullptr) { if(shape == nullptr || bounds == nullptr) {
return MSDF_ERR_INVALID_ARG; return MSDF_ERR_INVALID_ARG;
} }
reinterpret_cast<msdfgen::Shape*>(shape)->boundMiters(bounds->l, bounds->b, bounds->r, bounds->t, border, miter_limit, polarity); reinterpret_cast<const msdfgen::Shape*>(shape)->boundMiters(bounds->l, bounds->b, bounds->r, bounds->t, border, miter_limit, polarity);
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
@ -322,15 +322,15 @@ MSDF_API int msdf_contour_get_edge(msdf_contour_const_handle contour, const size
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
MSDF_API int msdf_contour_bound(msdf_contour_handle contour, msdf_bounds_t* bounds) { MSDF_API int msdf_contour_bound(msdf_contour_const_handle contour, msdf_bounds_t* bounds) {
if(contour == nullptr || bounds == nullptr) { if(contour == nullptr || bounds == nullptr) {
return MSDF_ERR_INVALID_ARG; return MSDF_ERR_INVALID_ARG;
} }
reinterpret_cast<msdfgen::Contour*>(contour)->bound(bounds->l, bounds->b, bounds->r, bounds->t); reinterpret_cast<const msdfgen::Contour*>(contour)->bound(bounds->l, bounds->b, bounds->r, bounds->t);
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }
MSDF_API int msdf_contour_bound_miters(msdf_contour_handle contour, MSDF_API int msdf_contour_bound_miters(msdf_contour_const_handle contour,
msdf_bounds_t* bounds, msdf_bounds_t* bounds,
const double border, const double border,
const double miter_limit, const double miter_limit,
@ -338,7 +338,7 @@ MSDF_API int msdf_contour_bound_miters(msdf_contour_handle contour,
if(contour == nullptr || bounds == nullptr) { if(contour == nullptr || bounds == nullptr) {
return MSDF_ERR_INVALID_ARG; return MSDF_ERR_INVALID_ARG;
} }
reinterpret_cast<msdfgen::Contour*>(contour)->boundMiters(bounds->l, bounds->b, bounds->r, bounds->t, border, miter_limit, polarity); reinterpret_cast<const msdfgen::Contour*>(contour)->boundMiters(bounds->l, bounds->b, bounds->r, bounds->t, border, miter_limit, polarity);
return MSDF_SUCCESS; return MSDF_SUCCESS;
} }

View File

@ -149,16 +149,16 @@ MSDF_API int msdf_shape_get_edge_count(msdf_shape_const_handle shape, size_t* ed
MSDF_API int msdf_shape_has_inverse_y_axis(msdf_shape_const_handle shape, int* inverse_y_axis); MSDF_API int msdf_shape_has_inverse_y_axis(msdf_shape_const_handle shape, int* inverse_y_axis);
MSDF_API int msdf_shape_normalize(msdf_shape_handle shape); MSDF_API int msdf_shape_normalize(msdf_shape_handle shape);
MSDF_API int msdf_shape_validate(msdf_shape_handle shape, int* result); MSDF_API int msdf_shape_validate(msdf_shape_handle shape, int* result);
MSDF_API int msdf_shape_bound(msdf_shape_handle shape, msdf_bounds_t* bounds); MSDF_API int msdf_shape_bound(msdf_shape_const_handle shape, msdf_bounds_t* bounds);
MSDF_API int msdf_shape_bound_miters(msdf_shape_handle shape, msdf_bounds_t* bounds, double border, double miter_limit, int polarity); MSDF_API int msdf_shape_bound_miters(msdf_shape_const_handle shape, msdf_bounds_t* bounds, double border, double miter_limit, int polarity);
MSDF_API void msdf_shape_free(msdf_shape_handle shape); MSDF_API void msdf_shape_free(msdf_shape_handle shape);
MSDF_API int msdf_contour_alloc(msdf_contour_handle* contour); MSDF_API int msdf_contour_alloc(msdf_contour_handle* contour);
MSDF_API int msdf_contour_add_edge(msdf_contour_handle contour, msdf_segment_handle* segment); MSDF_API int msdf_contour_add_edge(msdf_contour_handle contour, msdf_segment_handle* segment);
MSDF_API int msdf_contour_get_edge_count(msdf_contour_const_handle contour, size_t* edge_count); MSDF_API int msdf_contour_get_edge_count(msdf_contour_const_handle contour, size_t* edge_count);
MSDF_API int msdf_contour_get_edge(msdf_contour_const_handle contour, size_t index, msdf_segment_const_handle* segment); MSDF_API int msdf_contour_get_edge(msdf_contour_const_handle contour, size_t index, msdf_segment_const_handle* segment);
MSDF_API int msdf_contour_bound(msdf_contour_handle contour, msdf_bounds_t* bounds); MSDF_API int msdf_contour_bound(msdf_contour_const_handle contour, msdf_bounds_t* bounds);
MSDF_API int msdf_contour_bound_miters(msdf_contour_handle contour, msdf_bounds_t* bounds, double border, double miter_limit, int polarity); MSDF_API int msdf_contour_bound_miters(msdf_contour_const_handle contour, msdf_bounds_t* bounds, double border, double miter_limit, int polarity);
MSDF_API int msdf_contour_get_winding(msdf_contour_const_handle contour, int* winding); MSDF_API int msdf_contour_get_winding(msdf_contour_const_handle contour, int* winding);
MSDF_API int msdf_contour_reverse(msdf_contour_handle contour); MSDF_API int msdf_contour_reverse(msdf_contour_handle contour);
MSDF_API void msdf_contour_free(msdf_contour_handle contour); MSDF_API void msdf_contour_free(msdf_contour_handle contour);