Bug 42419 - Failed to create sub-surface by cairo_surface_create_for_rectangle()
Summary: Failed to create sub-surface by cairo_surface_create_for_rectangle()
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 1.10.3
Hardware: x86 (IA32) Linux (All)
: highest critical
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL: https://bugzilla.samba.org/show_bug.c...
Depends on:
Reported: 2011-10-31 04:41 UTC by Seongwon Cho
Modified: 2018-08-25 13:50 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Seongwon Cho 2011-10-31 04:41:09 UTC

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

Comment 1 GitLab Migration User 2018-08-25 13:50:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/226.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.