[gtk/wip/baedert/transforms6: 45/52] widget: Apply CSS transform in size_allocate_transformed
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/transforms6: 45/52] widget: Apply CSS transform in size_allocate_transformed
- Date: Thu, 14 Feb 2019 07:11:33 +0000 (UTC)
commit e2094ee5175cda671325cf0d4c92446d2908bbb6
Author: Timm Bäder <mail baedert org>
Date: Sat Jan 19 09:01:02 2019 +0100
widget: Apply CSS transform in size_allocate_transformed
gtk/gtkwidget.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d34fe67c28..402c3f9e69 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -35,6 +35,7 @@
#include "gtkbuilderprivate.h"
#include "gtkcontainerprivate.h"
#include "gtkcssfiltervalueprivate.h"
+#include "gtkcsstransformvalueprivate.h"
#include "gtkcssfontvariationsvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
@@ -4325,6 +4326,32 @@ gtk_widget_size_allocate_transformed (GtkWidget *widget,
real_allocation.height = MAX (1, real_allocation.height);
}
+ /* Apply CSS transformation */
+ {
+ graphene_matrix_t css_transform;
+ GtkCssValue *transform_value = _gtk_style_context_peek_property (_gtk_widget_get_style_context (widget),
+ GTK_CSS_PROPERTY_TRANSFORM);
+
+
+ if (!gtk_css_transform_value_is_none (transform_value) &&
+ gtk_css_transform_value_get_matrix (transform_value, &css_transform))
+ {
+ graphene_matrix_translate (&final_transform,
+ &(graphene_point3d_t) {
+ - real_allocation.width / 2.0f,
+ - real_allocation.height / 2.0f,
+ 0
+ });
+ graphene_matrix_multiply (&final_transform, &css_transform, &final_transform);
+ graphene_matrix_translate (&final_transform,
+ &(graphene_point3d_t) {
+ real_allocation.width / 2.0f,
+ real_allocation.height / 2.0f,
+ 0
+ });
+ }
+ }
+
baseline_changed = priv->allocated_baseline != baseline;
size_changed = (priv->allocation.width != real_allocation.width ||
priv->allocation.height != real_allocation.height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]