aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-08-03 11:47:14 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-08-03 11:47:14 +0200
commitc4552c95fcf3a60a92504039cd8ee89ebf63c724 (patch)
treeac424bd7aaa87e3de2490a8e0333fa5ad95f7212
parentb6d52d462e7914ff962d9214a127a4e007e08735 (diff)
downloadtracker.lv2-c4552c95fcf3a60a92504039cd8ee89ebf63c724.zip
tracker.lv2-c4552c95fcf3a60a92504039cd8ee89ebf63c724.tar.gz
tracker.lv2-c4552c95fcf3a60a92504039cd8ee89ebf63c724.tar.bz2
tracker.lv2-c4552c95fcf3a60a92504039cd8ee89ebf63c724.tar.xz
Squashed 'subprojects/d2tk/' changes from 25ed6fac..5633cfaf
5633cfaf base: don't draw out-of-bounds flowmatrix nodes. 8c4ff976 core: fix cliping in bitmap routines. ea1ad7bd valgrind: fix uninitialized values. git-subtree-dir: subprojects/d2tk git-subtree-split: 5633cfaf0b2cf3152ccdb8154c42e497e91c90b0
-rw-r--r--VERSION2
-rw-r--r--src/base.c30
-rw-r--r--src/core.c16
-rw-r--r--test/base.c4
4 files changed, 42 insertions, 10 deletions
diff --git a/VERSION b/VERSION
index e9d9580..7ace64a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.759
+0.1.765
diff --git a/src/base.c b/src/base.c
index da1df31..280ce17 100644
--- a/src/base.c
+++ b/src/base.c
@@ -483,7 +483,7 @@ d2tk_layout_begin(const d2tk_rect_t *rect, unsigned N, const d2tk_coord_t *frac,
unsigned tot = 0;
unsigned missing = 0;
- for(unsigned i = 0; i < N; i ++)
+ for(unsigned i = 0; i < N; i++)
{
tot += frac[i];
@@ -536,13 +536,16 @@ d2tk_layout_begin(const d2tk_rect_t *rect, unsigned N, const d2tk_coord_t *frac,
D2TK_API bool
d2tk_layout_not_end(d2tk_layout_t *lay)
{
- return lay->k < lay->N;
+ return lay;
}
D2TK_API d2tk_layout_t *
d2tk_layout_next(d2tk_layout_t *lay)
{
- ++lay->k;
+ if(++lay->k >= lay->N)
+ {
+ return NULL;
+ }
if(lay->flag & D2TK_FLAG_LAYOUT_Y)
{
@@ -3126,6 +3129,8 @@ D2TK_API d2tk_flowmatrix_t *
d2tk_flowmatrix_begin(d2tk_base_t *base, const d2tk_rect_t *rect, d2tk_id_t id,
d2tk_flowmatrix_t *flowmatrix)
{
+ memset(flowmatrix, 0x0, sizeof(d2tk_flowmatrix_t));
+
flowmatrix->base = base;
flowmatrix->id = id;
flowmatrix->rect = rect;
@@ -3142,9 +3147,6 @@ d2tk_flowmatrix_begin(d2tk_base_t *base, const d2tk_rect_t *rect, d2tk_id_t id,
flowmatrix->r = flowmatrix->scale * 4; //FIXME
flowmatrix->s = flowmatrix->scale * 20; //FIXME
- flowmatrix->src_conn = false;
- flowmatrix->dst_conn = false;
-
d2tk_core_t *core = base->core;
flowmatrix->ref = d2tk_core_bbox_container_push(core, false, flowmatrix->rect);
@@ -3304,6 +3306,19 @@ d2tk_flowmatrix_node_begin(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix,
node->rect.w = w;
node->rect.h = h;
+ d2tk_core_t *core = base->core;
+ d2tk_coord_t cw;
+ d2tk_coord_t ch;
+
+ d2tk_core_get_dimensions(core, &cw, &ch);
+ if( (node->rect.x >= cw)
+ || (node->rect.y >= ch)
+ || (node->rect.x <= -node->rect.w)
+ || (node->rect.y <= -node->rect.h) )
+ {
+ return NULL;
+ }
+
const d2tk_style_t *style = d2tk_base_get_style(base);
const uint64_t hash = d2tk_hash_foreach(flowmatrix, sizeof(d2tk_flowmatrix_t),
@@ -3312,7 +3327,6 @@ d2tk_flowmatrix_node_begin(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix,
style, sizeof(d2tk_style_t),
NULL);
- d2tk_core_t *core = base->core;
D2TK_CORE_WIDGET(core, hash, widget)
{
const d2tk_coord_t r = flowmatrix->r;
@@ -3417,6 +3431,8 @@ d2tk_flowmatrix_arc_begin(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix,
unsigned N, unsigned M, const d2tk_pos_t *src, const d2tk_pos_t *dst,
d2tk_pos_t *pos, d2tk_flowmatrix_arc_t *arc)
{
+ memset(arc, 0x0, sizeof(d2tk_flowmatrix_arc_t));
+
// derive initial position
if( (pos->x == 0) && (pos->y == 0) )
{
diff --git a/src/core.c b/src/core.c
index 7910dd1..33506c8 100644
--- a/src/core.c
+++ b/src/core.c
@@ -404,17 +404,33 @@ _d2tk_clip_clip(d2tk_core_t *core, d2tk_clip_t *dst, const d2tk_clip_t *src)
{
dst->x0 = 0;
}
+ if(dst->x1 < 0)
+ {
+ dst->x1 = 0;
+ }
if(dst->y0 < 0)
{
dst->y0 = 0;
}
+ if(dst->y1 < 0)
+ {
+ dst->y1 = 0;
+ }
+ if(dst->x0 >= core->w)
+ {
+ dst->x0 = core->w - 1;
+ }
if(dst->x1 >= core->w)
{
dst->x1 = core->w - 1;
}
+ if(dst->y0 >= core->h)
+ {
+ dst->y0 = core->h - 1;
+ }
if(dst->y1 >= core->h)
{
dst->y1 = core->h - 1;
diff --git a/test/base.c b/test/base.c
index 87b57fe..f470c79 100644
--- a/test/base.c
+++ b/test/base.c
@@ -779,7 +779,7 @@ _test_layout_relative_x()
const d2tk_rect_t rect = D2TK_RECT(0, 0, DIM_W, DIM_H);
assert(base);
- const d2tk_coord_t frac [N] = {
+ static const d2tk_coord_t frac [N] = {
1, 2, 4, 0
};
unsigned i = 0;
@@ -809,7 +809,7 @@ _test_layout_relative_y()
const d2tk_rect_t rect = D2TK_RECT(0, 0, DIM_W, DIM_H);
assert(base);
- const d2tk_coord_t frac [N] = {
+ static const d2tk_coord_t frac [N] = {
1, 2, 4, 0
};
unsigned i = 0;