From 8fb5bb319a76554bd9e274c7627bf13a6ff95e6b Mon Sep 17 00:00:00 2001 From: equilet <2237372+equilet@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:37:06 -0800 Subject: [PATCH] fixed bug in drawing code that was causing only half the img to render --- source/morphograph.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/source/morphograph.cpp b/source/morphograph.cpp index 8af15d9..6a805be 100644 --- a/source/morphograph.cpp +++ b/source/morphograph.cpp @@ -128,21 +128,6 @@ public: //could be a memory leak here } - void begin_shape(){ - - if(shape==std::string("linegraph")){ - linestr = "<"; //open - //default strings for filewriter - float tx = (x / float(vecsize)) * float(params->width); - float ty = params->height; - object_post((t_object *)obj, "ty is: %f", ty); - calc_position_info(tx, ty); - - linestr.append("path d=\"M " + xs + " " + ys + " "); - } - - } - void eval_drawstyle(){ switch(drawstyle){ case 0: //stroke; consider stroke width @@ -176,6 +161,22 @@ public: } + void draw_init(){ + //any drawing initialization should happen here + + if(shape==std::string("linegraph")){ + linestr = "<"; //open + //default strings for filewriter + float tx = (x / float(vecsize)) * float(params->width); + float ty = params->height; + object_post((t_object *)obj, "ty is: %f", ty); + calc_position_info(tx, ty); + + linestr.append("path d=\"M " + xs + " " + ys + " "); + } + + } + void draw(){ lws = std::to_string(linewidth); @@ -456,7 +457,7 @@ public: for (unsigned i = 0; i < layers.size(); ++i) { //how do we know that energy's size is the size of a vector??? //need to look into this - long vsize = layers[i].desc.energy.size(); + long vsize = layers[i].desc.energy.size() / 2; //j represents the analysis frame //why do we need to skip analysis frames? @@ -468,8 +469,7 @@ public: swrite.set_drawstyle(x->l_style->s_name); swrite.set_vecsize(vsize); - - swrite.begin_shape(); + swrite.draw_init(); for (unsigned j = 0; j < vsize; j += skip_by) { -- 2.34.1