diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-17 20:44:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-18 09:55:07 +0100 |
commit | 21360bf6748b30cf58d54561e40a1aa711d8d7af (patch) | |
tree | 07fd82575db39d23bc2e96758b1a78aff07f0654 /test/surface-pattern-big-scale-down.c | |
parent | 794160c35baf39593942ba71b45e4e75d2a87103 (diff) | |
download | cairo-21360bf6748b30cf58d54561e40a1aa711d8d7af.tar.gz |
[test/source-surface-big-scaled-down] Propagate error.
Propagate error to source.
Diffstat (limited to 'test/surface-pattern-big-scale-down.c')
-rw-r--r-- | test/surface-pattern-big-scale-down.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/test/surface-pattern-big-scale-down.c b/test/surface-pattern-big-scale-down.c index 49cf6adef..21b8000bc 100644 --- a/test/surface-pattern-big-scale-down.c +++ b/test/surface-pattern-big-scale-down.c @@ -37,28 +37,36 @@ static const cairo_test_t test = { draw }; -static void -setup_source_surface (cairo_surface_t *surface, int w, int h) +static cairo_surface_t * +create_source_surface (int w, int h) { - cairo_t *cr = cairo_create (surface); + cairo_surface_t *surface; + cairo_t *cr; - cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); - cairo_rectangle (cr, 0, 0, w/2, h/2); - cairo_fill (cr); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, SRC_WIDTH, SRC_HEIGHT); + cr = cairo_create (surface); + cairo_surface_destroy (surface); - cairo_set_source_rgb (cr, 0.0, 1.0, 0.0); - cairo_rectangle (cr, w/2, 0, w/2, h/2); - cairo_fill (cr); + cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); + cairo_rectangle (cr, 0, 0, w/2, h/2); + cairo_fill (cr); - cairo_set_source_rgb (cr, 0.0, 0.0, 1.0); - cairo_rectangle (cr, 0, h/2, w/2, h/2); - cairo_fill (cr); + cairo_set_source_rgb (cr, 0.0, 1.0, 0.0); + cairo_rectangle (cr, w/2, 0, w/2, h/2); + cairo_fill (cr); - cairo_set_source_rgb (cr, 1.0, 1.0, 0.0); - cairo_rectangle (cr, w/2, h/2, w/2, h/2); - cairo_fill (cr); + cairo_set_source_rgb (cr, 0.0, 0.0, 1.0); + cairo_rectangle (cr, 0, h/2, w/2, h/2); + cairo_fill (cr); + + cairo_set_source_rgb (cr, 1.0, 1.0, 0.0); + cairo_rectangle (cr, w/2, h/2, w/2, h/2); + cairo_fill (cr); - cairo_destroy (cr); + surface = cairo_surface_reference (cairo_get_target (cr)); + cairo_destroy (cr); + + return surface; } static void @@ -85,8 +93,7 @@ draw (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr, 0, 0, 0); cairo_paint (cr); - surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, SRC_WIDTH, SRC_HEIGHT); - setup_source_surface (surface, SRC_WIDTH, SRC_HEIGHT); + surface = create_source_surface (SRC_WIDTH, SRC_HEIGHT); pat = cairo_pattern_create_for_surface (surface); cairo_surface_destroy (surface); |