summaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-12-14 18:43:39 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-12-14 18:43:39 +0100
commita2bf642cce97e5efca75f1a334f9e27035104b6d (patch)
treed2c1495e874a69b5a431cec19528452faf233048 /src
parentf6e9ae5b87e8eeb19c64a782b77c6db2cb6a805c (diff)
doxy + sphinx, device_status, unit vectors, save commit before testing html5 layout
Diffstat (limited to 'src')
-rw-r--r--src/vectors.h21
-rw-r--r--src/vkvg_device.c6
-rw-r--r--src/vkvg_fonts.h1
-rw-r--r--src/vkvg_internal.h2
4 files changed, 26 insertions, 4 deletions
diff --git a/src/vectors.h b/src/vectors.h
index d8fd6a2..0a75828 100644
--- a/src/vectors.h
+++ b/src/vectors.h
@@ -29,11 +29,17 @@ typedef struct {
float y;
}vec2;
+static const vec2 vec2_unit_x = {1.f,0};
+static const vec2 vec2_unit_y = {0,1.f};
+
typedef struct {
double x;
double y;
}vec2d;
+/*const vec2d vec2d_unit_x = {1.0,0};
+const vec2d vec2d_unit_y = {0,1.0};*/
+
typedef struct {
float x;
float y;
@@ -73,6 +79,11 @@ typedef struct {
int16_t y;
}vec2i16;
+typedef struct {
+ vec2 row0;
+ vec2 row1;
+}mat2;
+
// compute length of float vector 2d
vkvg_inline float vec2_length(vec2 v){
return sqrtf (v.x*v.x + v.y*v.y);
@@ -187,4 +198,14 @@ vkvg_inline vec2 vec2d_to_vec2(vec2d vd){
vkvg_inline bool vec4_equ (vec4 a, vec4 b){
return (EQUF(a.x,b.x)&EQUF(a.y,b.y)&EQUF(a.z,b.z)&EQUF(a.w,b.w));
}
+vkvg_inline vec2 mat2_mult_vec2 (mat2 m, vec2 v) {
+ return (vec2){
+ (m.row0.x * v.x) + (m.row0.y * v.y),
+ (m.row1.x * v.x) + (m.row1.y * v.y)
+ };
+}
+vkvg_inline float mat2_det (mat2* m) {
+ return (m->row0.x * m->row1.y) - (m->row0.y * m->row1.y);
+}
+
#endif
diff --git a/src/vkvg_device.c b/src/vkvg_device.c
index 8888672..e90edef 100644
--- a/src/vkvg_device.c
+++ b/src/vkvg_device.c
@@ -115,6 +115,7 @@ VkvgDevice vkvg_device_create_from_vk_multisample(VkInstance inst, VkPhysicalDev
dev->deferredResolve = deferredResolve;
dev->vkDev = vkdev;
dev->phy = phy;
+ dev->status = VKVG_STATUS_SUCCESS;
#if VKVG_DBG_STATS
dev->debug_stats = (vkvg_debug_stats_t) {0};
@@ -194,7 +195,6 @@ VkvgDevice vkvg_device_create_from_vk_multisample(VkInstance inst, VkPhysicalDev
vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_IMAGE_VIEW, (uint64_t)vkh_image_get_view(dev->emptyImg), "empty IMG VIEW");
vkh_device_set_object_name((VkhDevice)dev, VK_OBJECT_TYPE_SAMPLER, (uint64_t)vkh_image_get_sampler(dev->emptyImg), "empty IMG SAMPLER");
#endif
-
return dev;
}
@@ -254,6 +254,9 @@ void vkvg_device_destroy (VkvgDevice dev)
free(dev);
}
+vkvg_status_t vkvg_device_status (VkvgDevice dev) {
+ return dev->status;
+}
VkvgDevice vkvg_device_reference (VkvgDevice dev) {
dev->references++;
return dev;
@@ -271,7 +274,6 @@ void vkvg_device_get_dpy (VkvgDevice dev, int* hdpy, int* vdpy) {
*hdpy = dev->hdpi;
*vdpy = dev->vdpi;
}
-
#if VKVG_DBG_STATS
vkvg_debug_stats_t vkvg_device_get_stats (VkvgDevice dev) {
return dev->debug_stats;
diff --git a/src/vkvg_fonts.h b/src/vkvg_fonts.h
index 528139a..5c88447 100644
--- a/src/vkvg_fonts.h
+++ b/src/vkvg_fonts.h
@@ -46,6 +46,7 @@
#include "vkvg.h"
#include "vkvg_buff.h"
#include "vkh.h"
+#include "vectors.h"
#define FT_CHECK_RESULT(f) \
{ \
diff --git a/src/vkvg_internal.h b/src/vkvg_internal.h
index ab972ef..396925a 100644
--- a/src/vkvg_internal.h
+++ b/src/vkvg_internal.h
@@ -63,9 +63,7 @@
#include "cross_os.h"
-#include "vectors.h"
#include "cross_mutex.h"
-
//width of the stencil buffer will determine the number of context saving/restore layers
//the two first bits of the stencil are the FILL and the CLIP bits, all other bits are
//used to store clipping bit on context saving. 8 bit stencil will allow 6 save/restore layer