mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-31 11:10:48 +02:00
Merge branch 'wip/otte/clear-clear' into 'master'
Clear is_clear flag on unmap_image() See merge request cairo/cairo!487
This commit is contained in:
commit
c1063ceb7e
3 changed files with 42 additions and 0 deletions
|
|
@ -854,6 +854,10 @@ cairo_int_status_t
|
|||
_cairo_image_surface_unmap_image (void *abstract_surface,
|
||||
cairo_image_surface_t *image)
|
||||
{
|
||||
cairo_image_surface_t *surface = abstract_surface;
|
||||
|
||||
surface->base.is_clear &= image->base.is_clear;
|
||||
|
||||
cairo_surface_finish (&image->base);
|
||||
cairo_surface_destroy (&image->base);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,38 @@ bit (cairo_t *cr, int width, int height)
|
|||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
clear (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_rectangle_int_t extents;
|
||||
cairo_t *cr2;
|
||||
|
||||
extents.x = extents.y = extents.width = extents.height = 1;
|
||||
|
||||
/* Fill background red */
|
||||
cairo_set_source_rgb (cr, 1, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
/* Get clear image */
|
||||
cairo_push_group (cr);
|
||||
|
||||
surface = cairo_surface_map_to_image (cairo_get_group_target (cr), &extents);
|
||||
cr2 = cairo_create (surface);
|
||||
cairo_set_source_rgb (cr2, 0, 0, 1);
|
||||
cairo_paint (cr2);
|
||||
cairo_destroy (cr2);
|
||||
cairo_surface_unmap_image (cairo_get_group_target (cr), surface);
|
||||
|
||||
pattern = cairo_pop_group (cr);
|
||||
/* all green */
|
||||
cairo_set_source_rgb (cr, 0, 1, 0);
|
||||
cairo_mask (cr, pattern);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
fill (cairo_t *cr, int width, int height)
|
||||
{
|
||||
|
|
@ -150,6 +182,12 @@ CAIRO_TEST (map_bit_to_image,
|
|||
"target=raster", /* requirements */
|
||||
WIDTH, HEIGHT,
|
||||
NULL, bit)
|
||||
CAIRO_TEST (map_clear_to_image,
|
||||
"Test mapping a clear surface to an image and modifying it externally marks it as not clear",
|
||||
"image", /* keywords */
|
||||
"target=raster", /* requirements */
|
||||
WIDTH, HEIGHT,
|
||||
NULL, clear)
|
||||
CAIRO_TEST (map_to_image_fill,
|
||||
"Test mapping a surface to an image and modifying it externally",
|
||||
"image", /* keywords */
|
||||
|
|
|
|||
BIN
test/reference/map-clear-to-image.ref.png
Normal file
BIN
test/reference/map-clear-to-image.ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 B |
Loading…
Add table
Reference in a new issue