forked from AuroraMiddleware/gtk
GtkWidget: Fix clipping to large subwindows
_gtk_widget_draw_internal() was clipping by passing the subwindow sizes as a path to cairo_clip(). This was breaking for windows larger than 23 bits in width/height, due to cairo using fixed point (24.8) for the path coordinates. We fix this by pre-clipping the subwindow region to the existing cairo clip region in the full 32bit gdkwindow precision. This fixes the GooCanvas Large Items test. https://bugzilla.gnome.org/show_bug.cgi?id=710958
This commit is contained in:
parent
961edcbfed
commit
864f7f7ebc
@ -6491,18 +6491,33 @@ _gtk_widget_draw_windows (GdkWindow *window,
|
||||
gboolean do_clip;
|
||||
GtkWidget *widget = NULL;
|
||||
GList *children, *l;
|
||||
GdkRectangle current_clip, window_clip;
|
||||
int x, y;
|
||||
|
||||
if (!gdk_window_is_viewable (window))
|
||||
return;
|
||||
|
||||
window_clip.x = window_x;
|
||||
window_clip.y = window_y;
|
||||
window_clip.width = gdk_window_get_width (window);
|
||||
window_clip.height = gdk_window_get_height (window);
|
||||
|
||||
/* Cairo paths are fixed point 24.8, but gdk supports 32bit window
|
||||
sizes, so we can't feed window_clip to e.g. cairo_rectangle()
|
||||
directly. Instead, we pre-clip the window clip to the existing
|
||||
clip regions in full 32bit precision and feed that to cairo. */
|
||||
if (!gdk_cairo_get_clip_rectangle (cr, ¤t_clip) ||
|
||||
!gdk_rectangle_intersect (&window_clip, ¤t_clip, &window_clip))
|
||||
return;
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr, window_x, window_y);
|
||||
cairo_rectangle (cr, 0, 0,
|
||||
gdk_window_get_width (window),
|
||||
gdk_window_get_height (window));
|
||||
cairo_rectangle (cr,
|
||||
window_clip.x, window_clip.y,
|
||||
window_clip.width, window_clip.height);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_translate (cr, window_x, window_y);
|
||||
|
||||
if (gdk_cairo_get_clip_rectangle (cr, NULL))
|
||||
{
|
||||
gdk_window_get_user_data (window, (gpointer *) &widget);
|
||||
|
Loading…
Reference in New Issue
Block a user