aboutsummaryrefslogtreecommitdiff
path: root/canvas.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-04-06 15:00:13 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-04-06 15:00:13 +0200
commitd057af0e2c03e95aa3d4417e355f43e87ebc903c (patch)
tree3761c0f60ce89b9b2006d3a03932461fadf2dcf7 /canvas.c
parentb7e6f8068fc544b82875ea859c5a706234ac791f (diff)
downloadcanvas_display.lv2-d057af0e2c03e95aa3d4417e355f43e87ebc903c.tar.xz
meson: add lv2_validate, lv2lint unit tests.
Diffstat (limited to 'canvas.c')
-rw-r--r--canvas.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/canvas.c b/canvas.c
index d97945c..3b7b887 100644
--- a/canvas.c
+++ b/canvas.c
@@ -23,6 +23,7 @@
#include <lv2/lv2plug.in/ns/ext/patch/patch.h>
#include <lv2/lv2plug.in/ns/ext/log/log.h>
#include <lv2/lv2plug.in/ns/ext/log/logger.h>
+#include <lv2/lv2plug.in/ns/ext/state/state.h>
#include <canvas.lv2/forge.h>
#define LV2_CANVAS_RENDER_CAIRO
@@ -635,12 +636,7 @@ _render(LV2_Handle instance, uint32_t w, uint32_t h)
int W;
int H;
- if(handle->aspect_ratio == 0.f)
- {
- W = w;
- H = h;
- }
- else if(handle->aspect_ratio <= 1.f)
+ if(handle->aspect_ratio < 1.f)
{
W = h * handle->aspect_ratio;
H = h;
@@ -650,6 +646,11 @@ _render(LV2_Handle instance, uint32_t w, uint32_t h)
W = w;
H = w / handle->aspect_ratio;
}
+ else // handle->aspect_ratio == 0.f
+ {
+ W = w;
+ H = h;
+ }
if( (surf->width != W) || (surf->height != H) || !surf->data)
{
@@ -686,11 +687,34 @@ cleanup(LV2_Handle instance)
free(handle);
}
+static LV2_State_Status
+_state_save(LV2_Handle instance, LV2_State_Store_Function store,
+ LV2_State_Handle state, uint32_t flags,
+ const LV2_Feature *const *features)
+{
+ return LV2_STATE_SUCCESS;
+}
+
+static LV2_State_Status
+_state_restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve,
+ LV2_State_Handle state, uint32_t flags,
+ const LV2_Feature *const *features)
+{
+ return LV2_STATE_SUCCESS;
+}
+
+static const LV2_State_Interface state_iface = {
+ .save = _state_save,
+ .restore = _state_restore
+};
+
static const void *
extension_data(const char *uri)
{
if(!strcmp(uri, LV2_INLINEDISPLAY__interface))
return &idisp_iface;
+ else if(!strcmp(uri, LV2_STATE__interface))
+ return &state_iface;
return NULL;
}