[gtk/wip/baedert/transforms6: 59/61] 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: 59/61] widget: Apply CSS transform in size_allocate_transformed
- Date: Wed, 23 Jan 2019 16:55:38 +0000 (UTC)
commit 4ac2dfeafb58bc574414696a5dc2f2b790b56302
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 3fbb0265ab..13b82bbecb 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"
@@ -4302,6 +4303,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]