Implement hexagram_cluster_resize(), hexagram_cluster_init()
This commit is contained in:
parent
393d35454d
commit
654dfac3d1
2 changed files with 27 additions and 10 deletions
|
@ -24,6 +24,14 @@ typedef struct _hexagram_cluster {
|
||||||
} state;
|
} state;
|
||||||
} hexagram_cluster;
|
} hexagram_cluster;
|
||||||
|
|
||||||
|
void hexagram_cluster_resize(hexagram_cluster *cluster,
|
||||||
|
double width,
|
||||||
|
double height);
|
||||||
|
|
||||||
|
void hexagram_cluster_init(hexagram_cluster *cluster,
|
||||||
|
double width,
|
||||||
|
double height);
|
||||||
|
|
||||||
hexagram_cluster *hexagram_cluster_new(double width,
|
hexagram_cluster *hexagram_cluster_new(double width,
|
||||||
double height);
|
double height);
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,9 @@
|
||||||
|
|
||||||
#include <hexagram/cluster.h>
|
#include <hexagram/cluster.h>
|
||||||
|
|
||||||
hexagram_cluster *hexagram_cluster_new(double width, double height) {
|
void hexagram_cluster_resize(hexagram_cluster *cluster,
|
||||||
hexagram_cluster *cluster;
|
double width,
|
||||||
|
double height) {
|
||||||
if ((cluster = malloc(sizeof(*cluster))) == NULL) {
|
|
||||||
goto error_malloc_cluster;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure correct cluster aspect ratio
|
* Ensure correct cluster aspect ratio
|
||||||
*/
|
*/
|
||||||
|
@ -50,11 +46,24 @@ hexagram_cluster *hexagram_cluster_new(double width, double height) {
|
||||||
|
|
||||||
cluster->width = width;
|
cluster->width = width;
|
||||||
cluster->height = height;
|
cluster->height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexagram_cluster_init(hexagram_cluster *cluster,
|
||||||
|
double width,
|
||||||
|
double height) {
|
||||||
|
hexagram_cluster_resize(cluster, width, height);
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize mutable state
|
|
||||||
*/
|
|
||||||
memset(&cluster->state, '\0', sizeof(cluster->state));
|
memset(&cluster->state, '\0', sizeof(cluster->state));
|
||||||
|
}
|
||||||
|
|
||||||
|
hexagram_cluster *hexagram_cluster_new(double width, double height) {
|
||||||
|
hexagram_cluster *cluster;
|
||||||
|
|
||||||
|
if ((cluster = malloc(sizeof(*cluster))) == NULL) {
|
||||||
|
goto error_malloc_cluster;
|
||||||
|
}
|
||||||
|
|
||||||
|
hexagram_cluster_init(cluster, width, height);
|
||||||
|
|
||||||
return cluster;
|
return cluster;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue