summaryrefslogtreecommitdiff
path: root/poly.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com>2009-04-07 17:04:13 -0400
committerSøren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com>2009-04-07 17:04:13 -0400
commit4413581da78eca03074d475bf4de6b61c1c474eb (patch)
treeec94178c4cefb40cbcadcbd19f2c51adc4153952 /poly.c
parent20545ed0a55a1a1fe387bb5175a8093701e2eb21 (diff)
Pentagon
Diffstat (limited to 'poly.c')
-rw-r--r--poly.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/poly.c b/poly.c
index 14c93c1..129b088 100644
--- a/poly.c
+++ b/poly.c
@@ -20,6 +20,12 @@ typedef pixman_fixed_16_16_t fixed_t;
#define fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
#define double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0))
+typedef enum
+{
+ WINDING,
+ EVEN_ODD
+} fill_rule_t;
+
/*
* +--------------------------------------------------+
@@ -174,29 +180,41 @@ compare_edges (const void *e1, const void *e2)
}
static void
-scan_convert (int n_edges, edge_t *edges)
+scan_convert (int n_edges, edge_t *edges, fill_rule_t fill_rule)
{
- /* First sort the edges according to scanline, then according to
- * X subpixel position.
+ int i;
+
+ /* First sort the edges
*/
qsort (edges, n_edges, sizeof (edge_t), compare_edges);
-
-
+
}
+#define df(a) pixman_double_to_fixed(a)
int
main (int argc, char **argv)
{
+ edge_t pentagon[] = {
+ { df (2.2), df (10.2), df (11.3), df (2.2) },
+ { df (11.3), df (2.2), df (15.7), df (5.5) },
+ { df (15.7), df (5.5), df (20.8), df (15.8) },
+ { df (20.8), df (15.8), df (13.2), df (25.2) },
+ { df (13.2), df (25.2), df (2.2), df (10.2) } };
+
gtk_init (&argc, &argv);
+ scan_convert (5, pentagon, WINDING);
+
+#if 0
ddda (0.5, 0.5, 2.5, 1.6);
ddda (0.3, 0.2, 3.7, 2.2);
ddda (3.7, 2.2, 7.2, 2.8);
ddda (3.7, 2.2, 4.2, 7.2);
ddda (0.5, 0.5, 1.5, 1.5);
ddda (0.5, 0.5, 2.5, 2.5);
+#endif
return 0;
}