summaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-08-27 23:18:12 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-08-30 13:55:10 +0200
commit4bb2cc40703fa624db0b301eb0b392e8d8c4899d (patch)
treefa635cb5fe313ae4ff98f362d977302e8de1ab76 /src
parentd0793f5cd45840307382e5edbc32e3813aeeb05a (diff)
doc wip, move log to vkvg_internals
Diffstat (limited to 'src')
-rw-r--r--src/vkvg_context.c10
-rw-r--r--src/vkvg_internal.h15
2 files changed, 16 insertions, 9 deletions
diff --git a/src/vkvg_context.c b/src/vkvg_context.c
index 6b49c9a..0ef3e10 100644
--- a/src/vkvg_context.c
+++ b/src/vkvg_context.c
@@ -802,14 +802,6 @@ void vkvg_paint (VkvgContext ctx){
void vkvg_set_source_rgb (VkvgContext ctx, float r, float g, float b) {
vkvg_set_source_rgba (ctx, r, g, b, 1);
}
-/**
- * @brief Set current pattern to solid color defined by arguments
- * @param vkvg context
- * @param red component
- * @param green component
- * @param blue component
- * @param alpha value
- */
void vkvg_set_source_rgba (VkvgContext ctx, float r, float g, float b, float a)
{
ctx->curColor = CreateRgbaf(r,g,b,a);
@@ -941,6 +933,8 @@ void vkvg_font_extents (VkvgContext ctx, vkvg_font_extents_t* extents) {
}
void vkvg_save (VkvgContext ctx){
+ if (ctx->status)
+ return;
LOG(VKVG_LOG_INFO, "SAVE CONTEXT: ctx = %p\n", ctx);
_flush_cmd_buff (ctx);
diff --git a/src/vkvg_internal.h b/src/vkvg_internal.h
index ec7ccde..5e85578 100644
--- a/src/vkvg_internal.h
+++ b/src/vkvg_internal.h
@@ -38,11 +38,24 @@
#define M_PIF 3.14159265358979323846f /* float pi */
#define M_PIF_2 1.57079632679489661923f
#define M_2_PIF 0.63661977236758134308f // 2/pi
-
/*#ifndef M_2_PI
#define M_2_PI 0.63661977236758134308 // 2/pi
#endif*/
+#ifdef DEBUG
+#define LOG(level,...) (vkvg_log_level & level) ? fprintf (stdout, __VA_ARGS__):true;
+#else
+#define LOG
+#endif
+
+#define VKVG_LOG_ERR 0x10
+#define VKVG_LOG_DEBUG 0x20
+#define VKVG_LOG_INFO 0x40
+#define VKVG_LOG_INFO_PATH 0x41
+#define VKVG_LOG_DBG_ARRAYS 0x80
+#define VKVG_LOG_FULL 0xff
+
+
#define PATH_CLOSED_BIT 0x80000000 /* most significant bit of path elmts is closed/open path state */
#define PATH_HAS_CURVES_BIT 0x40000000 /* 2d most significant bit of path elmts if curve data are present,
stored to avoid emiting joins in curves */