git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
small bugfixes and memory optimizations
[swftools.git]
/
lib
/
gfxpoly
/
poly.h
diff --git
a/lib/gfxpoly/poly.h
b/lib/gfxpoly/poly.h
index
ff623d3
..
417c6c1
100644
(file)
--- a/
lib/gfxpoly/poly.h
+++ b/
lib/gfxpoly/poly.h
@@
-3,13
+3,14
@@
#include <stdint.h>
#include "../q.h"
#include <stdint.h>
#include "../q.h"
+#include "../types.h"
//#define DEBUG
#define CHECKS
#define SPLAY
typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t;
//#define DEBUG
#define CHECKS
#define SPLAY
typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t;
-typedef enum {EVENT_CROSS, EVENT_END, EVENT_CORNER, EVENT_START, EVENT_HORIZONTAL} eventtype_t;
+typedef enum {EVENT_CROSS, EVENT_END, EVENT_START, EVENT_HORIZONTAL} eventtype_t;
typedef enum {SLOPE_POSITIVE, SLOPE_NEGATIVE} slope_t;
typedef struct _point {
typedef enum {SLOPE_POSITIVE, SLOPE_NEGATIVE} slope_t;
typedef struct _point {
@@
-21,16
+22,6
@@
typedef struct _fillstyle {
char is_filled;
} fillstyle_t;
char is_filled;
} fillstyle_t;
-typedef struct _edge {
- point_t a;
- point_t b;
- fillstyle_t*style;
-#ifdef DEBUG
- int tmp;
-#endif
- struct _edge *next;
-} edge_t;
-
typedef struct _windstate
{
char is_filled;
typedef struct _windstate
{
char is_filled;
@@
-52,6
+43,18
@@
typedef struct _windrule
#define SEGNR(s) ((s)?(s)->nr:-1)
#define SEGNR(s) ((s)?(s)->nr:-1)
+typedef struct _gfxpolystroke {
+ segment_dir_t dir;
+ int num_points;
+ point_t*points;
+ fillstyle_t*fs;
+ struct _gfxpolystroke*next;
+} gfxpolystroke_t;
+typedef struct _gfxpoly {
+ double gridsize;
+ gfxpolystroke_t*strokes;
+} gfxpoly_t;
+
typedef struct _segment {
point_t a;
point_t b;
typedef struct _segment {
point_t a;
point_t b;
@@
-68,7
+71,7
@@
typedef struct _segment {
int polygon_nr;
windstate_t wind;
int polygon_nr;
windstate_t wind;
- int nr;
+ ptroff_t nr;
#ifdef SPLAY
struct _segment*parent;
#ifdef SPLAY
struct _segment*parent;
@@
-81,6
+84,9
@@
typedef struct _segment {
point_t pos;
point_t pos;
+ gfxpolystroke_t*stroke;
+ int stroke_pos;
+
dict_t scheduled_crossings;
} segment_t;
dict_t scheduled_crossings;
} segment_t;
@@
-100,39
+106,14
@@
typedef struct _segment {
#define XDIFF(s1,s2,ypos) (((s1)->k + (double)(s1)->delta.x*ypos)*(s2)->delta.y - \
((s2)->k + (double)(s2)->delta.x*ypos)*(s1)->delta.y)
#define XDIFF(s1,s2,ypos) (((s1)->k + (double)(s1)->delta.x*ypos)*(s2)->delta.y - \
((s2)->k + (double)(s2)->delta.x*ypos)*(s1)->delta.y)
-typedef struct _gfxpoly {
- double gridsize;
- edge_t*edges;
-} gfxpoly_t;
-
-typedef struct _gfxstroke {
- segment_dir_t dir;
- int num_points;
- point_t*points;
- fillstyle_t*fs;
-} gfxstroke_t;
-typedef struct _gfxcompactpoly {
- double gridsize;
- int num_strokes;
- gfxstroke_t*strokes;
-} gfxcompactpoly_t;
-
void gfxpoly_fail(char*expr, char*file, int line, const char*function);
void gfxpoly_fail(char*expr, char*file, int line, const char*function);
-gfxpoly_t* gfxpoly_new(double gridsize);
char gfxpoly_check(gfxpoly_t*poly);
int gfxpoly_size(gfxpoly_t*poly);
void gfxpoly_dump(gfxpoly_t*poly);
char gfxpoly_check(gfxpoly_t*poly);
int gfxpoly_size(gfxpoly_t*poly);
void gfxpoly_dump(gfxpoly_t*poly);
-gfxpoly_t* gfxpoly_save(gfxpoly_t*poly, const char*filename);
+void gfxpoly_save(gfxpoly_t*poly, const char*filename);
gfxpoly_t* gfxpoly_process(gfxpoly_t*poly, windrule_t*windrule, windcontext_t*context);
gfxpoly_t* gfxpoly_process(gfxpoly_t*poly, windrule_t*windrule, windcontext_t*context);
-typedef struct _event {
- eventtype_t type;
- point_t p;
- segment_t*s1;
- segment_t*s2;
-} event_t;
-
#ifndef CHECKS
#ifdef assert
#undef assert
#ifndef CHECKS
#ifdef assert
#undef assert