forked from AuroraMiddleware/gtk
Invalidate cairo surface if resizing is not supported for target
While X11 surfaces can be resized, this is not the case for Quartz surfaces. Instead of resizing we will invalidate the surface instead. By giving _gdk_windowing_set_cairo_surface_size() a boolean return value, we can signal back whether or not resizing was possible. If not possible, we invalidate the surface.
This commit is contained in:
parent
9c6696dfcc
commit
d819bc4814
@ -511,9 +511,9 @@ void _gdk_display_pointer_info_foreach (GdkDisplay *display,
|
||||
void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
||||
cairo_region_t *region);
|
||||
|
||||
void _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height);
|
||||
gboolean _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
cairo_surface_t * _gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
|
@ -1054,11 +1054,18 @@ recompute_visible_regions_internal (GdkWindowObject *private,
|
||||
width = private->abs_x + private->width;
|
||||
height = private->abs_y + private->height;
|
||||
|
||||
_gdk_windowing_set_cairo_surface_size (private->cairo_surface,
|
||||
width, height);
|
||||
cairo_surface_set_device_offset (private->cairo_surface,
|
||||
private->abs_x,
|
||||
private->abs_y);
|
||||
if (_gdk_windowing_set_cairo_surface_size (private->cairo_surface,
|
||||
width, height))
|
||||
{
|
||||
cairo_surface_set_device_offset (private->cairo_surface,
|
||||
private->abs_x,
|
||||
private->abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_surface_destroy (private->cairo_surface);
|
||||
private->cairo_surface = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,13 @@ typedef struct {
|
||||
CGContextRef cg_context;
|
||||
} GdkQuartzCairoSurfaceData;
|
||||
|
||||
void
|
||||
gboolean
|
||||
_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
/* This is not supported with quartz surfaces. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -670,12 +670,13 @@ gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
|
||||
return impl->cairo_surface;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
// Do nothing. The surface size is determined by the DC
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -461,12 +461,13 @@ gdk_x11_cairo_surface_destroy (void *data)
|
||||
impl->cairo_surface = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_xlib_surface_set_size (surface, width, height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
|
Loading…
Reference in New Issue
Block a user