]> O.S.I.I.S - jp/vkvg.git/commitdiff
get_matrix with const pointer
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Jun 2022 04:00:45 +0000 (06:00 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Jun 2022 04:00:45 +0000 (06:00 +0200)
include/vkvg.h
src/vkvg_context.c

index a30d73bd62e6d32ebff1e25b8bed41b55c882268..3483a1ee37e85894ec5ac857514312bd71bb744b 100644 (file)
@@ -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.
  *
index 895c546a79c65b9a4dc8405d1e5cb12b67c60c37..ea5b1f5dc7a83d6242ea107987611b1d2e0a3dea 100644 (file)
@@ -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) {