git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial revision
[swftools.git]
/
lib
/
gfxtools.c
diff --git
a/lib/gfxtools.c
b/lib/gfxtools.c
index
e075059
..
296bea1
100644
(file)
--- a/
lib/gfxtools.c
+++ b/
lib/gfxtools.c
@@
-37,6
+37,12
@@
static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
gfxline_t*l = rfx_alloc(sizeof(gfxline_t));
l->type = gfx_moveTo;
linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
gfxline_t*l = rfx_alloc(sizeof(gfxline_t));
l->type = gfx_moveTo;
+ if((int)((d->x * 5120) == (int)(x * 5120)) &&
+ (int)((d->y * 5120) == (int)(y * 5120))) {
+ /* never mind- we're already there */
+ return;
+
+ }
d->x = l->x = x;
d->y = l->y = y;
l->next = 0;
d->x = l->x = x;
d->y = l->y = y;
l->next = 0;
@@
-467,8
+473,8
@@
void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, doubl
num = approximate3(&c, q, 128, maxerror*maxerror);
for(t=0;t<num;t++) {
num = approximate3(&c, q, 128, maxerror*maxerror);
for(t=0;t<num;t++) {
- FPOINT mid;
- FPOINT to;
+ gfxpoint_t mid;
+ gfxpoint_t to;
mid.x = q[t].control.x;
mid.y = q[t].control.y;
to.x = q[t].end.x;
mid.x = q[t].control.x;
mid.y = q[t].control.y;
to.x = q[t].end.x;
@@
-479,7
+485,7
@@
void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, doubl
gfxbbox_t gfxbbox_expand_to_point(gfxbbox_t box, gfxcoord_t x, gfxcoord_t y)
{
gfxbbox_t gfxbbox_expand_to_point(gfxbbox_t box, gfxcoord_t x, gfxcoord_t y)
{
- if(box.xmin==0 || box.ymin==0 || box.xmax==0 || box.ymax==0) {
+ if(box.xmin==0 && box.ymin==0 && box.xmax==0 && box.ymax==0) {
box.xmin = x;
box.ymin = y;
box.xmax = x;
box.xmin = x;
box.ymin = y;
box.xmax = x;
@@
-517,21
+523,21
@@
gfxbbox_t gfxline_getbbox(gfxline_t*line)
last = 0;
}
x = line->x;
last = 0;
}
x = line->x;
- y = line->x;
+ y = line->y;
line = line->next;
}
return bbox;
}
line = line->next;
}
return bbox;
}
-void gfxline_dump(gfxline_t*line, FILE*fi)
+void gfxline_dump(gfxline_t*line, FILE*fi, char*prefix)
{
while(line) {
if(line->type == gfx_moveTo) {
{
while(line) {
if(line->type == gfx_moveTo) {
- fprintf(fi, "moveTo %.2f %.2f\n", line->x, line->y);
+ fprintf(fi, "%smoveTo %.2f %.2f\n", prefix, line->x, line->y);
} else if(line->type == gfx_lineTo) {
} else if(line->type == gfx_lineTo) {
- fprintf(fi, "lineTo %.2f %.2f\n", line->x, line->y);
+ fprintf(fi, "%slineTo %.2f %.2f\n", prefix, line->x, line->y);
} else if(line->type == gfx_splineTo) {
} else if(line->type == gfx_splineTo) {
- fprintf(fi, "splineTo (%.2f %.2f) %.2f %.2f\n", line->sx, line->sy, line->x, line->y);
+ fprintf(fi, "%ssplineTo (%.2f %.2f) %.2f %.2f\n", prefix, line->sx, line->sy, line->x, line->y);
}
line = line->next;
}
}
line = line->next;
}