[gtk/wip/baedert/transforms7: 4/4] testwidgettransform: Fixup
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/transforms7: 4/4] testwidgettransform: Fixup
- Date: Sun, 17 Feb 2019 12:43:57 +0000 (UTC)
commit 3539b6e92b395c663ee26514789ef4c21ebfda7d
Author: Timm Bäder <mail baedert org>
Date: Sun Feb 17 13:42:38 2019 +0100
testwidgettransform: Fixup
tests/testwidgettransforms.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index 874f0c9d30..0c0ef675f3 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -6,9 +6,9 @@ static const char *css =
"test>button {"
" all: unset; "
" background-color: white;"
-/*" border: 30px solid blue;"*/
-/*" margin: 40px;"*/
-/*" padding: 40px;"*/
+" border: 30px solid teal;"
+" margin: 40px;"
+" padding: 40px;"
"}"
"test>button:hover {"
" background-color: blue;"
@@ -24,7 +24,6 @@ GtkWidget *test_widget;
GtkWidget *test_child;
float scale = 1;
gboolean do_picking = TRUE;
-graphene_matrix_t global_transform;
static const GdkRGBA RED = {1, 0, 0, 0.4};
static const GdkRGBA GREEN = {0, 1, 0, 0.7};
@@ -105,6 +104,7 @@ gtk_transform_tester_size_allocate (GtkWidget *widget,
int baseline)
{
GtkTransformTester *self = (GtkTransformTester *)widget;
+ graphene_matrix_t global_transform;
int w, h;
if (!self->test_widget)
@@ -117,18 +117,25 @@ gtk_transform_tester_size_allocate (GtkWidget *widget,
gtk_widget_measure (self->test_widget, GTK_ORIENTATION_VERTICAL, w,
&h, NULL, NULL, NULL);
+ g_message ("%s: %d, %d", __FUNCTION__, w, h);
+
graphene_matrix_init_identity (&global_transform);
- graphene_matrix_translate (&global_transform, &(graphene_point3d_t){ -w/2.0f, -h/2.0f, 0});
+ graphene_matrix_translate (&global_transform, &(graphene_point3d_t){ width / 2.0f, height / 2.0f, 0});
graphene_matrix_rotate (&global_transform, scale,
graphene_vec3_z_axis ());
- graphene_matrix_translate (&global_transform, &(graphene_point3d_t){ width / 2.0f, height / 2.0f, 0});
+ graphene_matrix_translate (&global_transform, &(graphene_point3d_t){ -w/2.0f, -h/2.0f, 0});
+#if 0
+ gtk_widget_size_allocate (self->test_widget,
+ &(GtkAllocation){ (width- w) / 2, (height - h) / 2, w,h }, -1);
+#else
gtk_widget_allocate (self->test_widget,
w, h,
-1,
&global_transform);
+#endif
}
static void
@@ -147,7 +154,6 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
if (!do_picking)
return;
-
gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds);
gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds);
@@ -189,8 +195,8 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
picked = gtk_widget_pick (widget, px, py);
#else
{
- double dx, dy;
- gtk_widget_translate_coordinatesf (widget, self->test_widget, px, py, &dx, &dy);
+ int dx, dy;
+ gtk_widget_translate_coordinates (widget, self->test_widget, px, py, &dx, &dy);
picked = gtk_widget_pick (self->test_widget, dx, dy);
}
#endif
@@ -208,8 +214,6 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
}
}
-
-
gtk_snapshot_append_color (snapshot, &BLACK,
&GRAPHENE_RECT_INIT (child_bounds.origin.x,
child_bounds.origin.y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]