git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
polygon intersector: finished active list splay tree optimization
[swftools.git]
/
lib
/
gfxpoly
/
convert.c
diff --git
a/lib/gfxpoly/convert.c
b/lib/gfxpoly/convert.c
index
5615612
..
aea0a17
100644
(file)
--- a/
lib/gfxpoly/convert.c
+++ b/
lib/gfxpoly/convert.c
@@
-1,18
+1,17
@@
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <math.h>
-#include <assert.h>
#include <string.h>
#include "../gfxdevice.h"
#include <string.h>
#include "../gfxdevice.h"
+#include "../mem.h"
#include "poly.h"
static edge_t*edge_new(int x1, int y1, int x2, int y2)
{
#include "poly.h"
static edge_t*edge_new(int x1, int y1, int x2, int y2)
{
- edge_t*s = malloc(sizeof(edge_t));
+ edge_t*s = rfx_calloc(sizeof(edge_t));
s->a.x = x1;
s->a.y = y1;
s->b.x = x2;
s->b.y = y2;
s->a.x = x1;
s->a.y = y1;
s->b.x = x2;
s->b.y = y2;
- s->next = 0;
return s;
}
return s;
}
@@
-29,7
+28,7
@@
static inline void gfxpoly_add_edge(gfxpoly_t*poly, double _x1, double _y1, doub
}
}
}
}
-gfxpoly_t* gfxpoly_fillToPoly(gfxline_t*line, double gridsize)
+gfxpoly_t* gfxpoly_from_gfxline(gfxline_t*line, double gridsize)
{
gfxpoly_t*p = gfxpoly_new(gridsize);
{
gfxpoly_t*p = gfxpoly_new(gridsize);
@@
-105,6
+104,7
@@
gfxpoly_t* gfxpoly_from_file(const char*filename, double gridsize)
return 0;
}
int count = 0;
return 0;
}
int count = 0;
+ double g = 0;
double lastx=0,lasty=0;
while(1) {
char*line = readline(fi);
double lastx=0,lasty=0;
while(1) {
char*line = readline(fi);
@@
-125,10
+125,16
@@
gfxpoly_t* gfxpoly_from_file(const char*filename, double gridsize)
}
lastx = x;
lasty = y;
}
lastx = x;
lasty = y;
+ } else if(sscanf(line, "%% gridsize %lf", &g) == 1) {
+ p->gridsize = g;
}
free(line);
}
fclose(fi);
}
free(line);
}
fclose(fi);
- printf("loaded %d points from %s\n", count, filename);
+ if(g) {
+ printf("loaded %d points from %s (gridsize %f)\n", count, filename, g);
+ } else {
+ printf("loaded %d points from %s\n", count, filename);
+ }
return p;
}
return p;
}