mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 11:50:16 +01:00
[win32] Trust the clipping code to trim roi to our surface
The higher level code ensures that the region of interest is trimmed to our declared surface extents, so performing the intersection again is redundant. Furthermore with the change in the clipping code, the fallback region is no longer clipped, especially as the clip that is currently set upon the DC is likely to be stale and incorrect for the fallback. Hopefully this resolves the assertion failure reported by Damian Frank, http://lists.cairographics.org/archives/cairo/2009-August/018015.html CC: Damian Frank <damian.frank@gmail.com>
This commit is contained in:
parent
d7faec024a
commit
b6d96bba8a
1 changed files with 9 additions and 44 deletions
|
|
@ -569,13 +569,12 @@ _cairo_win32_surface_acquire_source_image (void *abstract_sur
|
|||
void **image_extra)
|
||||
{
|
||||
cairo_win32_surface_t *surface = abstract_surface;
|
||||
cairo_win32_surface_t *local = NULL;
|
||||
cairo_win32_surface_t *local;
|
||||
cairo_status_t status;
|
||||
|
||||
if (surface->image) {
|
||||
*image_out = (cairo_image_surface_t *)surface->image;
|
||||
*image_extra = NULL;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -587,7 +586,6 @@ _cairo_win32_surface_acquire_source_image (void *abstract_sur
|
|||
|
||||
*image_out = (cairo_image_surface_t *)local->image;
|
||||
*image_extra = local;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -612,61 +610,28 @@ _cairo_win32_surface_acquire_dest_image (void *abstract_surfa
|
|||
cairo_win32_surface_t *surface = abstract_surface;
|
||||
cairo_win32_surface_t *local = NULL;
|
||||
cairo_status_t status;
|
||||
RECT clip_box;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
if (surface->image) {
|
||||
GdiFlush();
|
||||
|
||||
image_rect->x = 0;
|
||||
image_rect->y = 0;
|
||||
image_rect->width = surface->extents.width;
|
||||
image_rect->height = surface->extents.height;
|
||||
|
||||
*image_out = (cairo_image_surface_t *)surface->image;
|
||||
*image_out = (cairo_image_surface_t *) surface->image;
|
||||
*image_extra = NULL;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (GetClipBox (surface->dc, &clip_box) == ERROR)
|
||||
return _cairo_win32_print_gdi_error ("_cairo_win3_surface_acquire_dest_image");
|
||||
|
||||
x1 = clip_box.left;
|
||||
x2 = clip_box.right;
|
||||
y1 = clip_box.top;
|
||||
y2 = clip_box.bottom;
|
||||
|
||||
if (interest_rect->x > x1)
|
||||
x1 = interest_rect->x;
|
||||
if (interest_rect->y > y1)
|
||||
y1 = interest_rect->y;
|
||||
if ((int) (interest_rect->x + interest_rect->width) < x2)
|
||||
x2 = interest_rect->x + interest_rect->width;
|
||||
if ((int) (interest_rect->y + interest_rect->height) < y2)
|
||||
y2 = interest_rect->y + interest_rect->height;
|
||||
|
||||
if (x1 >= x2 || y1 >= y2) {
|
||||
*image_out = NULL;
|
||||
*image_extra = NULL;
|
||||
|
||||
*image_rect = surface->extents;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
status = _cairo_win32_surface_get_subimage (abstract_surface,
|
||||
x1, y1, x2 - x1, y2 - y1,
|
||||
interest_rect->x,
|
||||
interest_rect->y,
|
||||
interest_rect->width,
|
||||
interest_rect->height,
|
||||
&local);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
*image_out = (cairo_image_surface_t *)local->image;
|
||||
*image_out = (cairo_image_surface_t *) local->image;
|
||||
*image_extra = local;
|
||||
|
||||
image_rect->x = x1;
|
||||
image_rect->y = y1;
|
||||
image_rect->width = x2 - x1;
|
||||
image_rect->height = y2 - y1;
|
||||
|
||||
*image_rect = *interest_rect;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue