Change pointer from in- to out-pointers in msdf_contour_add_edge and msdf_shape_add_contour

This commit is contained in:
KitsuneAlex 2024-05-06 23:35:52 +02:00
parent 553d09bc1d
commit ef7cdfcb69
No known key found for this signature in database
GPG Key ID: 6B0CE864BB69B7D0
2 changed files with 8 additions and 10 deletions

View File

@ -205,11 +205,11 @@ MSDF_API int msdf_shape_get_bounds(msdf_shape_const_handle shape, msdf_bounds_t*
return MSDF_SUCCESS;
}
MSDF_API int msdf_shape_add_contour(msdf_shape_handle shape, msdf_contour_handle* contour) {
MSDF_API int msdf_shape_add_contour(msdf_shape_handle shape, msdf_contour_handle contour) {
if(shape == nullptr || contour == nullptr) {
return MSDF_ERR_INVALID_ARG;
}
*contour = reinterpret_cast<msdf_contour_handle>(&reinterpret_cast<msdfgen::Shape*>(shape)->addContour());
reinterpret_cast<msdfgen::Shape*>(shape)->addContour(*reinterpret_cast<msdfgen::Contour*>(contour));
return MSDF_SUCCESS;
}
@ -295,12 +295,11 @@ MSDF_API int msdf_contour_alloc(msdf_contour_handle* contour) {
return MSDF_SUCCESS;
}
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) {
if(contour == nullptr || segment == nullptr) {
return MSDF_ERR_INVALID_ARG;
}
msdfgen::EdgeSegment* p_segment = reinterpret_cast<msdfgen::Contour*>(contour)->addEdge();
*segment = reinterpret_cast<msdf_segment_handle>(p_segment);
reinterpret_cast<msdfgen::Contour*>(contour)->addEdge({reinterpret_cast<msdfgen::EdgeSegment*>(segment)});
return MSDF_SUCCESS;
}

View File

@ -218,10 +218,10 @@ MSDF_API int msdf_shape_get_bounds(msdf_shape_const_handle shape, msdf_bounds_t*
/**
* Adds a new contour to the given shape.
* @param shape A pointer to a shape object to add a new contour to.
* @param contour A pointer to an address which is populated with the address of the newly created contour.
* @param contour A pointer to the contour to add to the shape.
* @returns @code MSDF_SUCCESS@endcode on success, otherwise one of the constants prefixed with @code MSDF_ERR_@endcode.
*/
MSDF_API int msdf_shape_add_contour(msdf_shape_handle shape, msdf_contour_handle* contour);
MSDF_API int msdf_shape_add_contour(msdf_shape_handle shape, msdf_contour_handle contour);
/**
* Retrieves the number of contours allocated within the given shape object.
@ -311,11 +311,10 @@ MSDF_API int msdf_contour_alloc(msdf_contour_handle* contour);
/**
* Adds a new edge to the given contour and returns its associated segment handle.
* @param contour A pointer to the contour to add a new edge (segment) to.
* @param segment A pointer to an address which is populated with the address of the newly
* added edge segment.
* @param segment A pointer to the segment to add as an edge.
* @returns @code MSDF_SUCCESS@endcode on success, otherwise one of the constants prefixed with @code MSDF_ERR_@endcode.
*/
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);
/**
* Retrieves the edge count of the given contour.