summaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-06-22 06:00:45 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2022-06-22 06:00:45 +0200
commitfae189723237dd5fa3b87bbe421f63a8e7f66ca7 (patch)
tree39d39da5dd747214576b5635f21f42f7b6da77f8
parent14e87d88493de3222f12feb9480907115d3514d2 (diff)
get_matrix with const pointer
-rw-r--r--include/vkvg.h13
-rw-r--r--src/vkvg_context.c4
2 files changed, 13 insertions, 4 deletions
diff --git a/include/vkvg.h b/include/vkvg.h
index a30d73b..3483a1e 100644
--- a/include/vkvg.h
+++ b/include/vkvg.h
@@ -752,7 +752,16 @@ VkvgSurface vkvg_surface_create_from_image (VkvgDevice dev, const char* filePath
*/
vkvg_public
VkvgSurface vkvg_surface_create_for_VkhImage (VkvgDevice dev, void* vkhImg);
-// VkvgSurface vkvg_surface_create_from_bitmap (VkvgDevice dev, unsigned char* img, uint32_t width, uint32_t height);
+/**
+ * @brief Create a new vkvg surface from an in memory rgba bitmap
+ * @param dev The vkvg device used for creating the surface.
+ * @param img a pointer to a rgba encoded bimap
+ * @param width the width of the provided bitmap.
+ * @param height the height of the provided bitmap.
+ * @return
+ */
+vkvg_public
+VkvgSurface vkvg_surface_create_from_bitmap (VkvgDevice dev, unsigned char* img, uint32_t width, uint32_t height);
/**
* @brief Increment reference count on the surface by one.
* @param The vkvg surface to increment the reference count for.
@@ -1684,7 +1693,7 @@ void vkvg_set_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix);
* @param matrix a valid #vkvg_matrix_t pointer to receive the current context's transform.
*/
vkvg_public
-void vkvg_get_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix);
+void vkvg_get_matrix (VkvgContext ctx, vkvg_matrix_t * const matrix);
/**
* @brief Set the current matrix to identity.
*
diff --git a/src/vkvg_context.c b/src/vkvg_context.c
index 895c546..ea5b1f5 100644
--- a/src/vkvg_context.c
+++ b/src/vkvg_context.c
@@ -1594,8 +1594,8 @@ void vkvg_set_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix){
ctx->pushConsts.mat = (*matrix);
_set_mat_inv_and_vkCmdPush (ctx);
}
-void vkvg_get_matrix (VkvgContext ctx, const vkvg_matrix_t* matrix){
- memcpy ((void*)matrix, &ctx->pushConsts.mat, sizeof(vkvg_matrix_t));
+void vkvg_get_matrix (VkvgContext ctx, vkvg_matrix_t* const matrix){
+ *matrix = ctx->pushConsts.mat;
}
void vkvg_elliptic_arc_to (VkvgContext ctx, float x2, float y2, bool largeArc, bool sweepFlag, float rx, float ry, float phi) {