mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-08 03:40:18 +01:00
[test/smask-text] Propagate error.
Use cairo_get_target() to propagate error from the secondary context.
This commit is contained in:
parent
b1e884cd89
commit
a56d4530d6
1 changed files with 6 additions and 6 deletions
|
|
@ -42,10 +42,14 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_t *cr2;
|
||||
cairo_text_extents_t extents;
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 1.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
mask = cairo_surface_create_similar (cairo_get_group_target (cr),
|
||||
CAIRO_CONTENT_ALPHA,
|
||||
width, height);
|
||||
cr2 = cairo_create (mask);
|
||||
cairo_surface_destroy (mask);
|
||||
|
||||
cairo_save (cr2); {
|
||||
cairo_set_operator (cr2, CAIRO_OPERATOR_CLEAR);
|
||||
|
|
@ -72,14 +76,10 @@ draw (cairo_t *cr, int width, int height)
|
|||
floor ((width - extents.width) / 2 + 0.5) - extents.x_bearing,
|
||||
floor ((height - extents.height) / 2 - 0.5) - extents.y_bearing);
|
||||
cairo_show_text (cr2, "cairo");
|
||||
cairo_destroy (cr2);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 1.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 1.0, 0, 0);
|
||||
cairo_mask_surface (cr, mask, 0, 0);
|
||||
cairo_surface_destroy (mask);
|
||||
cairo_mask_surface (cr, cairo_get_target (cr2), 0, 0);
|
||||
cairo_destroy (cr2);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue