[test] Revamp surface-source

Include a translucent region in the source that exercises the xlib bug
that I'm trying to fix. Hmm.
This commit is contained in:
Chris Wilson 2009-09-22 18:20:03 +01:00
parent 941d3693fa
commit 9948b5180a
24 changed files with 47 additions and 8 deletions

View file

@ -548,7 +548,8 @@ REFERENCE_IMAGES = \
huge-radial.ref.png \ huge-radial.ref.png \
image-surface-source.ps2.ref.png \ image-surface-source.ps2.ref.png \
image-surface-source.ps3.ref.png \ image-surface-source.ps3.ref.png \
image-surface-source.ref.png \ image-surface-source.rgb24.ref.png \
image-surface-source.argb32.ref.png \
image-surface-source.svg12.argb32.xfail.png \ image-surface-source.svg12.argb32.xfail.png \
image-surface-source.svg12.rgb24.xfail.png \ image-surface-source.svg12.rgb24.xfail.png \
implicit-close.ref.png \ implicit-close.ref.png \
@ -747,12 +748,14 @@ REFERENCE_IMAGES = \
path-append.xlib-fallback.ref.png \ path-append.xlib-fallback.ref.png \
path-append.xlib.ref.png \ path-append.xlib.ref.png \
pattern-getters.ref.png \ pattern-getters.ref.png \
pdf-surface-source.ref.png \ pdf-surface-source.rgb24.ref.png \
pdf-surface-source.argb32.ref.png \
pdf-surface-source.svg12.argb32.xfail.png \ pdf-surface-source.svg12.argb32.xfail.png \
pdf-surface-source.svg12.rgb24.xfail.png \ pdf-surface-source.svg12.rgb24.xfail.png \
pixman-rotate.ref.png \ pixman-rotate.ref.png \
pixman-rotate.rgb24.ref.png \ pixman-rotate.rgb24.ref.png \
ps-surface-source.ref.png \ ps-surface-source.rgb24.ref.png \
ps-surface-source.argb32.ref.png \
ps-surface-source.svg12.argb32.xfail.png \ ps-surface-source.svg12.argb32.xfail.png \
ps-surface-source.svg12.rgb24.xfail.png \ ps-surface-source.svg12.rgb24.xfail.png \
push-group.ref.png \ push-group.ref.png \
@ -761,9 +764,10 @@ REFERENCE_IMAGES = \
push-group.xlib.rgb24.ref.png \ push-group.xlib.rgb24.ref.png \
push-group-color.ref.png \ push-group-color.ref.png \
push-group-color.xlib.ref.png \ push-group-color.xlib.ref.png \
quartz-surface-source.rgb24.ref.png \
quartz-surface-source.argb32.ref.png \
quartz-surface-source.ps2.ref.png \ quartz-surface-source.ps2.ref.png \
quartz-surface-source.ps3.ref.png \ quartz-surface-source.ps3.ref.png \
quartz-surface-source.ref.png \
radial-gradient.pdf.ref.png \ radial-gradient.pdf.ref.png \
radial-gradient.quartz.ref.png \ radial-gradient.quartz.ref.png \
radial-gradient.ref.png \ radial-gradient.ref.png \
@ -922,7 +926,8 @@ REFERENCE_IMAGES = \
surface-pattern.ps.xfail.png \ surface-pattern.ps.xfail.png \
surface-pattern.ref.png \ surface-pattern.ref.png \
surface-pattern.svg.xfail.png \ surface-pattern.svg.xfail.png \
svg-surface-source.ref.png \ svg-surface-source.rgb24.ref.png \
svg-surface-source.argb32.ref.png \
svg-surface-source.svg12.argb32.xfail.png \ svg-surface-source.svg12.argb32.xfail.png \
svg-surface-source.svg12.rgb24.xfail.png \ svg-surface-source.svg12.rgb24.xfail.png \
test-fallback16-surface-source.ps.ref.png \ test-fallback16-surface-source.ps.ref.png \
@ -1023,9 +1028,10 @@ REFERENCE_IMAGES = \
user-font.svg.ref.png \ user-font.svg.ref.png \
user-font.xlib.ref.png \ user-font.xlib.ref.png \
xlib-expose-event.ref.png \ xlib-expose-event.ref.png \
xlib-surface-source.rgb24.ref.png \
xlib-surface-source.argb32.ref.png \
xlib-surface-source.ps2.ref.png \ xlib-surface-source.ps2.ref.png \
xlib-surface-source.ps3.ref.png \ xlib-surface-source.ps3.ref.png \
xlib-surface-source.ref.png \
xlib-surface-source.svg12.argb32.xfail.png \ xlib-surface-source.svg12.argb32.xfail.png \
xlib-surface-source.svg12.rgb24.xfail.png \ xlib-surface-source.svg12.rgb24.xfail.png \
zero-alpha.ref.png zero-alpha.ref.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

View file

@ -34,16 +34,22 @@ static cairo_surface_t *create_source_surface (int size);
*/ */
#define SOURCE_SIZE 2000 #define SOURCE_SIZE 2000
#define INTER_SIZE 512 #define INTER_SIZE 512
#define SIZE 90 #define SIZE 96
static void static void
draw_pattern (cairo_surface_t **surface_inout, int surface_size) draw_pattern (cairo_surface_t **surface_inout, int surface_size)
{ {
cairo_t *cr; cairo_t *cr;
int mid = surface_size/2;
cr = cairo_create (*surface_inout); cr = cairo_create (*surface_inout);
cairo_surface_destroy (*surface_inout); cairo_surface_destroy (*surface_inout);
cairo_rectangle (cr, 0, 0, surface_size, surface_size);
cairo_rectangle (cr, mid - SIZE/4, mid + SIZE/4, SIZE/2, -SIZE/2);
cairo_clip (cr);
/* outside squares -> opaque */
cairo_set_source_rgb (cr, 1, 1, 1); cairo_set_source_rgb (cr, 1, 1, 1);
cairo_rectangle (cr, cairo_rectangle (cr,
0, 0, 0, 0,
@ -65,6 +71,33 @@ draw_pattern (cairo_surface_t **surface_inout, int surface_size)
surface_size / 2, surface_size / 2); surface_size / 2, surface_size / 2);
cairo_fill (cr); cairo_fill (cr);
cairo_reset_clip (cr);
cairo_rectangle (cr, mid - SIZE/4, mid - SIZE/4, SIZE/2, SIZE/2);
cairo_clip (cr);
/* inside squares -> translucent */
cairo_set_source_rgba (cr, 0, 0, 1, .5);
cairo_rectangle (cr,
0, 0,
surface_size / 2, surface_size / 2);
cairo_fill (cr);
cairo_set_source_rgba (cr, 0, 1, 0, .5);
cairo_rectangle (cr,
surface_size / 2, 0,
surface_size / 2, surface_size / 2);
cairo_fill (cr);
cairo_set_source_rgba (cr, 1, 0, 0, .5);
cairo_rectangle (cr,
0, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr);
cairo_set_source_rgba (cr, 1, 1, 1, .5);
cairo_rectangle (cr,
surface_size / 2, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr);
*surface_inout = cairo_surface_reference (cairo_get_target (cr)); *surface_inout = cairo_surface_reference (cairo_get_target (cr));
cairo_destroy (cr); cairo_destroy (cr);
} }
@ -101,7 +134,7 @@ draw (cairo_t *cr, int width, int height)
(width - INTER_SIZE)/2, (width - INTER_SIZE)/2,
(height - INTER_SIZE)/2); (height - INTER_SIZE)/2);
cairo_destroy (cr2); cairo_destroy (cr2);
cairo_rectangle (cr, 15, 15, 60, 60); cairo_rectangle (cr, 16, 16, 64, 64);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_fill (cr); cairo_fill (cr);

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B