aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2021-07-14 23:04:49 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2021-07-14 23:04:49 +0200
commit156c634dc50dea6a9169480682ee19c11956f231 (patch)
tree6828df5b7e3ec640850cc2fa0e1dc231602aa3bf
parent3a7c02b8479b2064e452b314f4e0e15cd81866d4 (diff)
downloadmoony.lv2-156c634dc50dea6a9169480682ee19c11956f231.tar.xz
canvas: fixes for canvas cairo/nanovg to coexist.
-rw-r--r--VERSION2
-rw-r--r--api/api.c23
-rw-r--r--include/moony.h8
-rw-r--r--meson.build14
-rw-r--r--plugin/d2tk_ui.c3
-rw-r--r--plugin/nk_ui.c2
6 files changed, 28 insertions, 24 deletions
diff --git a/VERSION b/VERSION
index 1ec2611..92275d7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.39.17
+0.39.23
diff --git a/api/api.c b/api/api.c
index f53a2c3..a3c29e8 100644
--- a/api/api.c
+++ b/api/api.c
@@ -32,6 +32,10 @@
#include <api_state.h>
#include <api_parameter.h>
+#if defined(BUILD_INLINE_DISP)
+# include <canvas.lv2/idisp.h>
+#endif
+
#define RDF_PREFIX "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
#define RDFS_PREFIX "http://www.w3.org/2000/01/rdf-schema#"
@@ -1191,7 +1195,7 @@ _idisp_render(LV2_Handle instance, uint32_t w, uint32_t h)
float aspect_ratio = 1.f; //FIXME
LV2_Inline_Display_Image_Surface *surf =
- lv2_canvas_idisp_surf_configure(&moony->canvas_idisp, w, h, aspect_ratio);
+ lv2_canvas_idisp_surf_configure(moony->canvas_idisp, w, h, aspect_ratio);
const LV2_Atom *value = NULL;
size_t tot_size = 0;
@@ -1216,7 +1220,7 @@ _idisp_render(LV2_Handle instance, uint32_t w, uint32_t h)
value = &fake;
}
- lv2_canvas_idisp_render_body(&moony->canvas_idisp, value->type, value->size,
+ lv2_canvas_idisp_render_body(moony->canvas_idisp, value->type, value->size,
LV2_ATOM_BODY_CONST(value));
return surf;
@@ -1482,7 +1486,8 @@ moony_init(moony_t *moony, const char *subject, double sample_rate,
moony->param_rows = ATOMIC_VAR_INIT(4);
#if defined(BUILD_INLINE_DISP)
- lv2_canvas_idisp_init(&moony->canvas_idisp, queue_draw, moony->map);
+ moony->canvas_idisp = calloc(1, sizeof(LV2_Canvas_Idisp));
+ lv2_canvas_idisp_init(moony->canvas_idisp, queue_draw, moony->map);
#endif
return 0;
@@ -1495,7 +1500,9 @@ moony_deinit(moony_t *moony)
if(moony->to_idisp)
varchunk_free(moony->to_idisp);
free(moony->canvas_graph);
- lv2_canvas_idisp_deinit(&moony->canvas_idisp);
+ lv2_canvas_idisp_deinit(moony->canvas_idisp);
+ free(moony->canvas_idisp);
+ moony->canvas_idisp = NULL;
#endif
LV2_Atom *state_atom_old = (LV2_Atom *)atomic_load_explicit(&moony->state_atom_new, memory_order_relaxed);
@@ -2215,7 +2222,7 @@ _moony_props_out(moony_t *moony, uint32_t frames, LV2_Atom_Forge *forge)
__realtime LV2_Worker_Status
moony_wake_worker(const LV2_Worker_Schedule *work_sched)
{
- int32_t dummy;
+ int32_t dummy = 0;
return work_sched->schedule_work(work_sched->handle, sizeof(int32_t), &dummy);
}
@@ -2363,7 +2370,7 @@ moony_in(moony_t *moony, const LV2_Atom_Sequence *control, LV2_Atom_Sequence *no
memcpy(dst, &fake, tot_size);
varchunk_write_advance(moony->to_idisp, tot_size);
- lv2_canvas_idisp_queue_draw(&moony->canvas_idisp);
+ lv2_canvas_idisp_queue_draw(moony->canvas_idisp);
}
#endif
}
@@ -2664,7 +2671,7 @@ moony_out(moony_t *moony, LV2_Atom_Sequence *notify, uint32_t frames)
memcpy(dst, value, tot_size);
varchunk_write_advance(moony->to_idisp, tot_size);
- lv2_canvas_idisp_queue_draw(&moony->canvas_idisp);
+ lv2_canvas_idisp_queue_draw(moony->canvas_idisp);
}
}
}
@@ -2703,7 +2710,7 @@ moony_out(moony_t *moony, LV2_Atom_Sequence *notify, uint32_t frames)
memcpy(dst, value, tot_size);
varchunk_write_advance(moony->to_idisp, tot_size);
- lv2_canvas_idisp_queue_draw(&moony->canvas_idisp);
+ lv2_canvas_idisp_queue_draw(moony->canvas_idisp);
}
}
}
diff --git a/include/moony.h b/include/moony.h
index 4cfeb62..235030f 100644
--- a/include/moony.h
+++ b/include/moony.h
@@ -69,9 +69,7 @@ struct _atom_ser_t {
#include <lauxlib.h>
#include <canvas.lv2/forge.h>
-#if defined(BUILD_INLINE_DISP)
-# include <canvas.lv2/idisp.h>
-#endif
+typedef struct _LV2_Canvas_Idisp LV2_Canvas_Idisp;
#define __realtime __attribute__((annotate("realtime")))
#define __non_realtime __attribute__((annotate("non-realtime")))
@@ -291,11 +289,9 @@ struct _moony_t {
xpress_t xpress;
LV2_Canvas_URID canvas_urid;
-#if defined(BUILD_INLINE_DISP)
- LV2_Canvas_Idisp canvas_idisp;
+ LV2_Canvas_Idisp *canvas_idisp;
varchunk_t *to_idisp;
LV2_Atom *canvas_graph;
-#endif
moony_vm_t *vm;
atomic_uintptr_t vm_new;
diff --git a/meson.build b/meson.build
index 0604274..6079b59 100644
--- a/meson.build
+++ b/meson.build
@@ -99,9 +99,6 @@ add_project_arguments('-DMOONY_VERSION="'+rawvers+'"', language : 'c')
add_project_arguments('-DMOONY_MINOR_VERSION='+version[1], language : 'c')
add_project_arguments('-DMOONY_MICRO_VERSION='+version[2], language : 'c')
add_project_arguments('-D_GNU_SOURCE', language : 'c')
-if build_inline_disp
- add_project_arguments('-DBUILD_INLINE_DISP', language : 'c')
-endif
if gc_method == 'manual'
message('using manual gc method')
@@ -125,6 +122,11 @@ c_args = [
'-Wno-attributes',
'-Wno-unused-function']
+extra_args = []
+if build_inline_disp
+ extra_args += '-DBUILD_INLINE_DISP'
+endif
+
laes128_lib = static_library('laes128',
join_paths('laes128', 'laes128.c'),
join_paths('tiny-AES128-C', 'aes.c'),
@@ -222,7 +224,7 @@ api_lib = static_library('api',
join_paths('api', 'api_vm.c'),
include_directories : inc_dir,
dependencies : dsp_deps,
- c_args : c_args)
+ c_args : [c_args, extra_args])
dsp_links = [laes128_lib, lascii85_lib, lbase64_lib, lcomplex_lib, lmathx_lib, lrandom_lib, lpeg_lib, lua_lib, tlsf_lib, api_lib]
@@ -238,7 +240,7 @@ app_srcs = [
join_paths('test', 'moony_test.c')]
mod = shared_module('moony', dsp_srcs,
- c_args : c_args,
+ c_args : [c_args, extra_args],
include_directories : inc_dir,
name_prefix : '',
dependencies : dsp_deps,
@@ -286,7 +288,7 @@ if build_opengl_ui
join_paths('plugin', 'nk_ui.c')]
nk_ui = shared_module('moony_ui', nk_ui_srcs,
- c_args : c_args,
+ c_args : [c_args, extra_args],
include_directories : inc_dir,
name_prefix : '',
dependencies : nk_ui_deps,
diff --git a/plugin/d2tk_ui.c b/plugin/d2tk_ui.c
index 54bbdda..9baac05 100644
--- a/plugin/d2tk_ui.c
+++ b/plugin/d2tk_ui.c
@@ -36,8 +36,7 @@
#include <d2tk/util.h>
#include <d2tk/frontend_pugl.h>
-#include <nanovg.h>
-
+#define LV2_CANVAS_RENDER_NANOVG_NO_IMPLEMENTATION
#include <canvas.lv2/render_nanovg.h>
#define MAX_NPROPS 16
diff --git a/plugin/nk_ui.c b/plugin/nk_ui.c
index 5e54651..3ed3e0e 100644
--- a/plugin/nk_ui.c
+++ b/plugin/nk_ui.c
@@ -34,7 +34,7 @@
#include <lauxlib.h>
#if defined(BUILD_INLINE_DISP)
-# include <canvas.lv2/render_cairo.h>
+# include <canvas.lv2/idisp.h>
#endif
extern int luaopen_lpeg(lua_State *L);