Failed to create sub-surface by cairo_surface_create_for_rectangle()
Submitted by Seongwon Cho
Assigned to Carl Worth @cworth
Description
Hi,
When I make sub-surface by cairo_surface_create_for_rectangle() I got nil surface on special use case.
inside of cairo_surface_create_for_rectangle(cairo_surface_t *target, double x, double y, double width, double height) cairo changes argument ,double to integer, like below.
surface->extents.x = ceil (x);
surface->extents.y = ceil (y);
surface->extents.width = floor (x + width) - surface->extents.x;
surface->extents.height = floor (y + height) - surface->extents.y;
But if I put the x = 0.2, width = 0.7 on cairo_surface_create_for_rectangle() the width of surface is assigned by -1.
surface->extents.x = 1; //ceil(0.2) == 1
surface->extents.width = -1; //floor(0.2+0.7) - 1 == 0 - 1 == -1
It looks like a cairo's bug
Thanks
Version: 1.10.3