summaryrefslogtreecommitdiff
path: root/meme/overlay.c
diff options
context:
space:
mode:
Diffstat (limited to 'meme/overlay.c')
-rw-r--r--meme/overlay.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/meme/overlay.c b/meme/overlay.c
index fd85de4..70bf4e2 100644
--- a/meme/overlay.c
+++ b/meme/overlay.c
@@ -13,7 +13,6 @@
#include <stdlib.h>
#include <stdio.h>
-#include <math.h>
#include "util.h"
#include "overlay.h"
@@ -46,7 +45,8 @@ void overlay_draw(const struct overlay *overlay,
}
-static struct overlay *overlay_load_file(FILE *file)
+static struct overlay *overlay_load_file(FILE *file,
+ void (*xform)(float x, float y, float *res_x, float *res_y))
{
struct overlay *over = NULL;
struct overlay *path = NULL;
@@ -81,8 +81,12 @@ static struct overlay *overlay_load_file(FILE *file)
over = path;
}
p = alloc_type(struct point);
- p->x = round(x * 1000);
- p->y = round(y * 1000);
+ if (xform) {
+ xform(x, y, &p->x, &p->y);
+ } else {
+ p->x = x;
+ p->y = y;
+ }
p->next = path->points;
path->points = p;
}
@@ -90,7 +94,8 @@ static struct overlay *overlay_load_file(FILE *file)
}
-struct overlay *overlay_load(const char *name)
+struct overlay *overlay_load(const char *name,
+ void (*xform)(float x, float y, float *res_x, float *res_y))
{
FILE *file;
struct overlay *over;
@@ -100,7 +105,7 @@ struct overlay *overlay_load(const char *name)
perror(name);
exit(1);
}
- over = overlay_load_file(file);
+ over = overlay_load_file(file, xform);
fclose(file);
return over;
}