app: fix various artifacts of the cancas' overlay children
gimp_overlay_child_size_allocate(): invalidate the old and new position of the child, and simplify the code by calling our own invalidate() function instead of duplicating its code. gimp_overlay_child_expose(): process pending updates on the overlay child's offscreen window before getting its pixmap.
This commit is contained in:
@ -230,7 +230,6 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
|
|||||||
GimpOverlayChild *child)
|
GimpOverlayChild *child)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkAllocation allocation;
|
|
||||||
GtkRequisition child_requisition;
|
GtkRequisition child_requisition;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
gint x;
|
gint x;
|
||||||
@ -241,7 +240,7 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
|
|||||||
|
|
||||||
widget = GTK_WIDGET (box);
|
widget = GTK_WIDGET (box);
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gimp_overlay_child_invalidate (box, child);
|
||||||
|
|
||||||
gtk_widget_get_child_requisition (child->widget, &child_requisition);
|
gtk_widget_get_child_requisition (child->widget, &child_requisition);
|
||||||
|
|
||||||
@ -252,30 +251,12 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
|
|||||||
|
|
||||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||||
|
|
||||||
gtk_widget_get_allocation (child->widget, &child_allocation);
|
|
||||||
|
|
||||||
if (gtk_widget_get_realized (GTK_WIDGET (widget)))
|
if (gtk_widget_get_realized (GTK_WIDGET (widget)))
|
||||||
{
|
gdk_window_move_resize (child->window,
|
||||||
GdkRectangle old_allocation;
|
child_allocation.x,
|
||||||
GdkRectangle old_bounds;
|
child_allocation.y,
|
||||||
|
child_allocation.width,
|
||||||
gdk_window_get_position (child->window,
|
child_allocation.height);
|
||||||
&old_allocation.x,
|
|
||||||
&old_allocation.y);
|
|
||||||
old_allocation.width = gdk_window_get_width (child->window);
|
|
||||||
old_allocation.height = gdk_window_get_height (child->window);
|
|
||||||
|
|
||||||
gimp_overlay_child_transform_bounds (child, &old_allocation, &old_bounds);
|
|
||||||
|
|
||||||
gdk_window_invalidate_rect (gtk_widget_get_window (widget),
|
|
||||||
&old_bounds, FALSE);
|
|
||||||
|
|
||||||
gdk_window_move_resize (child->window,
|
|
||||||
child_allocation.x,
|
|
||||||
child_allocation.y,
|
|
||||||
child_allocation.width,
|
|
||||||
child_allocation.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_matrix_init_identity (&child->matrix);
|
cairo_matrix_init_identity (&child->matrix);
|
||||||
|
|
||||||
@ -289,10 +270,13 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GdkRectangle bounds;
|
GtkAllocation allocation;
|
||||||
gint border;
|
GdkRectangle bounds;
|
||||||
gint available_width;
|
gint border;
|
||||||
gint available_height;
|
gint available_width;
|
||||||
|
gint available_height;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
gimp_overlay_child_transform_bounds (child, &child_allocation, &bounds);
|
gimp_overlay_child_transform_bounds (child, &child_allocation, &bounds);
|
||||||
|
|
||||||
@ -315,6 +299,8 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
|
|||||||
|
|
||||||
/* local transform */
|
/* local transform */
|
||||||
cairo_matrix_rotate (&child->matrix, child->angle);
|
cairo_matrix_rotate (&child->matrix, child->angle);
|
||||||
|
|
||||||
|
gimp_overlay_child_invalidate (box, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -342,8 +328,13 @@ gimp_overlay_child_expose (GimpOverlayBox *box,
|
|||||||
if (gtk_widget_get_visible (child->widget) &&
|
if (gtk_widget_get_visible (child->widget) &&
|
||||||
gdk_rectangle_intersect (&event->area, &bounds, NULL))
|
gdk_rectangle_intersect (&event->area, &bounds, NULL))
|
||||||
{
|
{
|
||||||
GdkPixmap *pixmap = gdk_offscreen_window_get_pixmap (child->window);
|
GdkPixmap *pixmap;
|
||||||
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
cairo_t *cr;
|
||||||
|
|
||||||
|
gdk_window_process_updates (child->window, FALSE);
|
||||||
|
|
||||||
|
pixmap = gdk_offscreen_window_get_pixmap (child->window);
|
||||||
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
|
|
||||||
gdk_cairo_region (cr, event->region);
|
gdk_cairo_region (cr, event->region);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
Reference in New Issue
Block a user