summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-12-29 12:16:53 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-12-29 12:55:05 +0000
commit84b81388bef4a2f300580081415fe09947edb96e (patch)
tree98a76486e29e7fa9052c58b3e7822e0a2d6b14be
parentefb17160904eda8fdb21fa1fd10a09081cf5cb3e (diff)
[test] Draw spline bbox
Add the stroked extents to the spline-decomposition test.
-rw-r--r--test/Makefile.am6
-rw-r--r--test/spline-decomposition.c63
-rw-r--r--test/spline-decomposition.pdf.ref.pngbin20404 -> 19156 bytes
-rw-r--r--test/spline-decomposition.ps.ref.pngbin0 -> 9090 bytes
-rw-r--r--test/spline-decomposition.ps2.ref.pngbin8957 -> 0 bytes
-rw-r--r--test/spline-decomposition.ps3.ref.pngbin8957 -> 0 bytes
-rw-r--r--test/spline-decomposition.ref.pngbin20402 -> 19107 bytes
-rw-r--r--test/spline-decomposition.svg.ref.pngbin0 -> 19156 bytes
-rw-r--r--test/spline-decomposition.svg11.ref.pngbin20404 -> 0 bytes
-rw-r--r--test/spline-decomposition.svg12.ref.pngbin20404 -> 0 bytes
10 files changed, 65 insertions, 4 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 7e067c84..d4bfbd38 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -902,11 +902,9 @@ REFERENCE_IMAGES = \
source-surface-scale-paint.ref.png \
source-surface-scale-paint.rgb24.ref.png \
spline-decomposition.ref.png \
- spline-decomposition.ps2.ref.png \
- spline-decomposition.ps3.ref.png \
+ spline-decomposition.ps.ref.png \
spline-decomposition.pdf.ref.png \
- spline-decomposition.svg11.ref.png \
- spline-decomposition.svg12.ref.png \
+ spline-decomposition.svg.ref.png \
stroke-ctm-caps.ps2.ref.png \
stroke-ctm-caps.ps3.ref.png \
surface-pattern-big-scale-down.ref.png \
diff --git a/test/spline-decomposition.c b/test/spline-decomposition.c
index f01a505e..ea8f26f2 100644
--- a/test/spline-decomposition.c
+++ b/test/spline-decomposition.c
@@ -310,8 +310,20 @@ thin_splines (cairo_t *cr)
#endif
static void
+draw_bbox (cairo_t *cr, double x0, double y0, double x1, double y1)
+{
+ cairo_rectangle (cr,
+ floor (x0) + .5, floor (y0) + .5,
+ ceil (x1) - floor (x0), ceil (y1) - floor (y0));
+ cairo_stroke (cr);
+}
+
+static void
stroke_splines (cairo_t *cr)
{
+ double stroke_x0, stroke_x1, stroke_y0, stroke_y1;
+ double path_x0, path_x1, path_y0, path_y1;
+
cairo_save (cr);
cairo_translate (cr, 15, 15);
@@ -322,8 +334,18 @@ stroke_splines (cairo_t *cr)
knots[0].b.x, knots[0].b.y,
knots[0].c.x, knots[0].c.y,
knots[0].d.x, knots[0].d.y);
+ cairo_stroke_extents (cr, &stroke_x0, &stroke_y0, &stroke_x1, &stroke_y1);
+ cairo_path_extents (cr, &path_x0, &path_y0, &path_x1, &path_y1);
cairo_stroke (cr);
+ cairo_save (cr); {
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ draw_bbox (cr, stroke_x0, stroke_y0, stroke_x1, stroke_y1);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ draw_bbox (cr, path_x0, path_y0, path_x1, path_y1);
+ } cairo_restore (cr);
+
cairo_translate (cr, 130, 0);
cairo_new_path (cr);
@@ -333,8 +355,18 @@ stroke_splines (cairo_t *cr)
knots[1].b.x, knots[1].b.y,
knots[1].c.x, knots[1].c.y,
knots[1].d.x, knots[1].d.y);
+ cairo_stroke_extents (cr, &stroke_x0, &stroke_y0, &stroke_x1, &stroke_y1);
+ cairo_path_extents (cr, &path_x0, &path_y0, &path_x1, &path_y1);
cairo_stroke (cr);
+ cairo_save (cr); {
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ draw_bbox (cr, stroke_x0, stroke_y0, stroke_x1, stroke_y1);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ draw_bbox (cr, path_x0, path_y0, path_x1, path_y1);
+ } cairo_restore (cr);
+
cairo_translate (cr, 130, 0);
cairo_new_path (cr);
@@ -344,8 +376,18 @@ stroke_splines (cairo_t *cr)
knots[2].b.x, knots[2].b.y,
knots[2].c.x, knots[2].c.y,
knots[2].d.x, knots[2].d.y);
+ cairo_stroke_extents (cr, &stroke_x0, &stroke_y0, &stroke_x1, &stroke_y1);
+ cairo_path_extents (cr, &path_x0, &path_y0, &path_x1, &path_y1);
cairo_stroke (cr);
+ cairo_save (cr); {
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ draw_bbox (cr, stroke_x0, stroke_y0, stroke_x1, stroke_y1);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ draw_bbox (cr, path_x0, path_y0, path_x1, path_y1);
+ } cairo_restore (cr);
+
cairo_translate (cr, -130 - 65, 130);
cairo_new_path (cr);
@@ -355,8 +397,18 @@ stroke_splines (cairo_t *cr)
knots[3].b.x, knots[3].b.y,
knots[3].c.x, knots[3].c.y,
knots[3].d.x, knots[3].d.y);
+ cairo_stroke_extents (cr, &stroke_x0, &stroke_y0, &stroke_x1, &stroke_y1);
+ cairo_path_extents (cr, &path_x0, &path_y0, &path_x1, &path_y1);
cairo_stroke (cr);
+ cairo_save (cr); {
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ draw_bbox (cr, stroke_x0, stroke_y0, stroke_x1, stroke_y1);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ draw_bbox (cr, path_x0, path_y0, path_x1, path_y1);
+ } cairo_restore (cr);
+
cairo_translate (cr, 130, 0);
cairo_new_path (cr);
@@ -366,7 +418,18 @@ stroke_splines (cairo_t *cr)
knots[4].b.x, knots[4].b.y,
knots[4].c.x, knots[4].c.y,
knots[4].d.x, knots[4].d.y);
+ cairo_stroke_extents (cr, &stroke_x0, &stroke_y0, &stroke_x1, &stroke_y1);
+ cairo_path_extents (cr, &path_x0, &path_y0, &path_x1, &path_y1);
cairo_stroke (cr);
+
+ cairo_save (cr); {
+ cairo_set_line_width (cr, 1);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ draw_bbox (cr, stroke_x0, stroke_y0, stroke_x1, stroke_y1);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ draw_bbox (cr, path_x0, path_y0, path_x1, path_y1);
+ } cairo_restore (cr);
+
cairo_restore (cr);
}
diff --git a/test/spline-decomposition.pdf.ref.png b/test/spline-decomposition.pdf.ref.png
index 4fd25a62..9ea094a7 100644
--- a/test/spline-decomposition.pdf.ref.png
+++ b/test/spline-decomposition.pdf.ref.png
Binary files differ
diff --git a/test/spline-decomposition.ps.ref.png b/test/spline-decomposition.ps.ref.png
new file mode 100644
index 00000000..2b3c07dc
--- /dev/null
+++ b/test/spline-decomposition.ps.ref.png
Binary files differ
diff --git a/test/spline-decomposition.ps2.ref.png b/test/spline-decomposition.ps2.ref.png
deleted file mode 100644
index ca1fbfd6..00000000
--- a/test/spline-decomposition.ps2.ref.png
+++ /dev/null
Binary files differ
diff --git a/test/spline-decomposition.ps3.ref.png b/test/spline-decomposition.ps3.ref.png
deleted file mode 100644
index ca1fbfd6..00000000
--- a/test/spline-decomposition.ps3.ref.png
+++ /dev/null
Binary files differ
diff --git a/test/spline-decomposition.ref.png b/test/spline-decomposition.ref.png
index 4e1b3448..bac35a9c 100644
--- a/test/spline-decomposition.ref.png
+++ b/test/spline-decomposition.ref.png
Binary files differ
diff --git a/test/spline-decomposition.svg.ref.png b/test/spline-decomposition.svg.ref.png
new file mode 100644
index 00000000..9ea094a7
--- /dev/null
+++ b/test/spline-decomposition.svg.ref.png
Binary files differ
diff --git a/test/spline-decomposition.svg11.ref.png b/test/spline-decomposition.svg11.ref.png
deleted file mode 100644
index 4fd25a62..00000000
--- a/test/spline-decomposition.svg11.ref.png
+++ /dev/null
Binary files differ
diff --git a/test/spline-decomposition.svg12.ref.png b/test/spline-decomposition.svg12.ref.png
deleted file mode 100644
index 4fd25a62..00000000
--- a/test/spline-decomposition.svg12.ref.png
+++ /dev/null
Binary files differ