summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-01-09 01:10:22 +0100
committerBenjamin Otte <otte@redhat.com>2017-01-09 01:12:06 +0100
commitdcb15d67287f17528b3a5fb0bc260a8e28a99a84 (patch)
treeec7d5642b3d5d8bd8285f5ef6c162647bbbc3568
parentdeb458c6568040f50916f1ac10e5dc93e0bcf0d5 (diff)
downloadgtk+-dcb15d67287f17528b3a5fb0bc260a8e28a99a84.tar.gz
cssgadget: Compute clip correctly
We were computing it relative to the gadget allocation, but it should be relative to the widget allocation.
-rw-r--r--gtk/gtkcssgadget.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/gtk/gtkcssgadget.c b/gtk/gtkcssgadget.c
index f25191b168..4d49185902 100644
--- a/gtk/gtkcssgadget.c
+++ b/gtk/gtkcssgadget.c
@@ -110,17 +110,6 @@ gtk_css_gadget_real_allocate (GtkCssGadget *gadget,
*out_clip = *allocation;
}
-static void
-gtk_css_gadget_get_clip (GtkCssGadget *gadget,
- graphene_rect_t *bounds)
-{
- GtkCssGadgetPrivate *priv = gtk_css_gadget_get_instance_private (gadget);
-
- graphene_rect_init (bounds,
- priv->clip.x - priv->allocated_size.x, priv->clip.y - priv->allocated_size.y,
- priv->clip.width, priv->clip.height);
-}
-
static gboolean
gtk_css_gadget_real_snapshot (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
@@ -837,14 +826,14 @@ gtk_css_gadget_snapshot (GtkCssGadget *gadget,
GtkCssStyle *style;
int x, y, width, height;
int contents_x, contents_y, contents_width, contents_height;
- GtkAllocation margin_box;
- graphene_rect_t bounds;
+ GtkAllocation margin_box, clip;
if (!gtk_css_gadget_get_visible (gadget))
return;
- gtk_css_gadget_get_clip (gadget, &bounds);
- if (gtk_snapshot_clips_rect (snapshot, &bounds))
+ clip = priv->clip;
+ shift_allocation (gadget, &clip);
+ if (gtk_snapshot_clips_rect (snapshot, &GRAPHENE_RECT_INIT(clip.x, clip.y, clip.width, clip.height)))
return;
gtk_css_gadget_get_margin_box (gadget, &margin_box);