aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-02-05 08:38:30 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-02-05 08:38:30 +0100
commitea34db3868405a67110f668eead4b33c30e06a36 (patch)
treeb5fd50b92befefa2530d09cdb3f9b2958e608bfb /src
parent87aa071b938e1098658cc02ad403c146f45d31b4 (diff)
downloadd2tk-ea34db3868405a67110f668eead4b33c30e06a36.tar.xz
base: simplify flowmatrix node iterator functions.
Diffstat (limited to 'src')
-rw-r--r--src/base.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/base.c b/src/base.c
index 1a68556..c7481aa 100644
--- a/src/base.c
+++ b/src/base.c
@@ -157,6 +157,7 @@ struct _d2tk_scrollbar_t {
};
struct _d2tk_flowmatrix_t {
+ d2tk_base_t *base;
d2tk_id_t id;
const d2tk_rect_t *rect;
d2tk_atom_body_t *atom_body;
@@ -167,6 +168,7 @@ struct _d2tk_flowmatrix_t {
};
struct _d2tk_flowmatrix_node_t {
+ d2tk_flowmatrix_t *flowmatrix;
d2tk_rect_t rect;
d2tk_state_t state;
};
@@ -2737,6 +2739,7 @@ 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)
{
+ flowmatrix->base = base;
flowmatrix->id = id;
flowmatrix->rect = rect;
flowmatrix->atom_body = _d2tk_base_get_atom(base, id, D2TK_ATOM_FLOW);
@@ -2759,8 +2762,9 @@ d2tk_flowmatrix_not_end(d2tk_flowmatrix_t *flowmatrix)
}
D2TK_API d2tk_flowmatrix_t *
-d2tk_flowmatrix_next(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix)
+d2tk_flowmatrix_next(d2tk_flowmatrix_t *flowmatrix)
{
+ d2tk_base_t *base = flowmatrix->base;
float *exponent = &flowmatrix->atom_body->flow.exponent;
const float old_exponent = *exponent;
@@ -2834,6 +2838,8 @@ D2TK_API d2tk_flowmatrix_node_t *
d2tk_flowmatrix_node_begin(d2tk_flowmatrix_t *flowmatrix, d2tk_pos_t *pos,
d2tk_flowmatrix_node_t *node)
{
+ node->flowmatrix = flowmatrix;
+
// derive initial position
if( (pos->x == 0) && (pos->y == 0) )
{
@@ -2862,9 +2868,12 @@ d2tk_flowmatrix_node_not_end(d2tk_flowmatrix_node_t *node)
}
D2TK_API d2tk_flowmatrix_node_t *
-d2tk_flowmatrix_node_next(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix,
- d2tk_pos_t *pos, const d2tk_state_t *state)
+d2tk_flowmatrix_node_next(d2tk_flowmatrix_node_t *node, d2tk_pos_t *pos,
+ const d2tk_state_t *state)
{
+ d2tk_flowmatrix_t *flowmatrix = node->flowmatrix;
+ d2tk_base_t *base = flowmatrix->base;
+
if(d2tk_state_is_motion(*state))
{
const d2tk_coord_t adx = base->mouse.dx / flowmatrix->scale;