diff --git a/include/libhqr.h b/include/libhqr.h index dd9286e8c2b85dd6d47ade6804a1b6ca10b213e9..eacd7a4c33bee7046245e65b553208dcd1cc024e 100644 --- a/include/libhqr.h +++ b/include/libhqr.h @@ -82,9 +82,9 @@ typedef enum libhqr_typefacto_ { * @brief Structure for stocking informations in order to draw the tree */ typedef struct libhqr_treedraw_s{ - int k; /**<The factorization step for the color*/ - int *tiles; /**<Table for tiles*/ - int tiles_size; /**<Size of the table*/ + int k; /**< The factorization step for the color */ + int *tiles; /**< Table for tiles */ + int tiles_size; /**< Size of the table */ } libhqr_treedraw_t; /** diff --git a/testings/testing_treedraw.c b/testings/testing_treedraw.c index 773d23aa23217ce86e6daaa59be3fc9050565e6b..c935ebedb8255be0fbc2f6650fc2ac21c30df526 100644 --- a/testings/testing_treedraw.c +++ b/testings/testing_treedraw.c @@ -17,7 +17,9 @@ #include <stdio.h> #include <string.h> +#include <stdlib.h> #include "libdraw.h" +#include "libhqr.h" #define WIDTH 50 #define HEIGHT 50 @@ -25,17 +27,22 @@ int main(int argc, char ** argv) { - FILE *tree = fopen("tree.svg","w+"); - int x,y,i,j; - libhqr_writeheader(tree); - libhqr_drawline(125,100,125,800,tree); - for (i = 1; i < 5; i++){ - for (j = 1; j < 9; j++){ - x = 100*i; - y = 100*j; - libhqr_drawTS(x,y,WIDTH,HEIGHT,3,tree); - } - } - libhqr_writeend(tree); - return 1; + libhqr_tree_t qrtree; + libhqr_tiledesc_t matrix; + int minMN; + libhqr_treedraw_t drawing; + matrix.nodes = 1; + matrix.p = 1; + matrix.mt = 8; + matrix.nt = 4; + libhqr_hqr_init( &qrtree, LIBHQR_QR, &matrix, LIBHQR_BINARY_TREE, LIBHQR_FLAT_TREE, 1, 1, 0, 0); + minMN = libhqr_imin(matrix.mt, matrix.nt ); + drawing.tiles = (int*)malloc(minMN*sizeof(int)); + drawing.tiles_size = minMN; + FILE *tree = fopen("tree.svg","w+"); + libhqr_writeheader(tree); + libhqr_treewalk(&qrtree, 0); + libhqr_writeend(tree); + free(drawing.tiles); + return 1; }