From ef7cdfcb6930d4d8c8cd783ed2905f24029a3b4b Mon Sep 17 00:00:00 2001 From: KitsuneAlex Date: Mon, 6 May 2024 23:35:52 +0200 Subject: [PATCH] Change pointer from in- to out-pointers in msdf_contour_add_edge and msdf_shape_add_contour --- core/msdfgen-c.cpp | 9 ++++----- msdfgen-c.h | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/core/msdfgen-c.cpp b/core/msdfgen-c.cpp index 5f44100..e7cce33 100644 --- a/core/msdfgen-c.cpp +++ b/core/msdfgen-c.cpp @@ -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(&reinterpret_cast(shape)->addContour()); + reinterpret_cast(shape)->addContour(*reinterpret_cast(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(contour)->addEdge(); - *segment = reinterpret_cast(p_segment); + reinterpret_cast(contour)->addEdge({reinterpret_cast(segment)}); return MSDF_SUCCESS; } diff --git a/msdfgen-c.h b/msdfgen-c.h index 957ad1a..f668e66 100644 --- a/msdfgen-c.h +++ b/msdfgen-c.h @@ -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.