[gtk/wip/otte/canvas: 35/36] canvas: scale(-1) the widgets when allocation size is negative
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/canvas: 35/36] canvas: scale(-1) the widgets when allocation size is negative
- Date: Tue, 5 Jul 2022 05:41:43 +0000 (UTC)
commit 67cd4052e9586397ece5860d3057506dccb1b7ac
Author: Benjamin Otte <otte redhat com>
Date: Tue Jul 5 07:30:51 2022 +0200
canvas: scale(-1) the widgets when allocation size is negative
Just flip the widgets, because hey, that makes planarity work!
gtk/gtkcanvasitem.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcanvasitem.c b/gtk/gtkcanvasitem.c
index 0ed91e7291..1d8484db45 100644
--- a/gtk/gtkcanvasitem.c
+++ b/gtk/gtkcanvasitem.c
@@ -308,6 +308,7 @@ gtk_canvas_item_allocate_widget (GtkCanvasItem *self,
float dy)
{
graphene_rect_t allocation;
+ GskTransform *transform;
if (self->widget == NULL)
return;
@@ -318,14 +319,14 @@ gtk_canvas_item_allocate_widget (GtkCanvasItem *self,
g_assert_not_reached ();
}
- graphene_rect_normalize (&allocation);
- gtk_widget_size_allocate (self->widget,
- &(GtkAllocation) {
- allocation.origin.x - dx,
- allocation.origin.y - dy,
- allocation.size.width,
- allocation.size.height
- }, -1);
+ transform = gsk_transform_translate (NULL, &allocation.origin);
+ transform = gsk_transform_scale (transform, signbit (allocation.size.width) ? -1 : 1, signbit
(allocation.size.height) ? -1 : 1);
+
+ gtk_widget_allocate (self->widget,
+ ABS (allocation.size.width),
+ ABS (allocation.size.height),
+ -1,
+ transform);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]