Patch added for performance problem in clutter text rendering
More details here: https://gitlab.gnome.org/GNOME/mutter/merge_requests/20
This commit is contained in:
parent
8aa341191e
commit
55c9fe5b90
@ -0,0 +1,108 @@
|
|||||||
|
From 8286557a0555058440536e88393fda445d49d399 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yussuf Khalil <dev@pp3345.net>
|
||||||
|
Date: Sun, 18 Feb 2018 21:21:44 +0100
|
||||||
|
Subject: [PATCH] clutter: Avoid unnecessary relayouts in ClutterText
|
||||||
|
|
||||||
|
We can save an unnecessary relayout if the required size to fully draw the text
|
||||||
|
is equal to the currently allocated size after the underlying text buffer or
|
||||||
|
attributes that only affect the PangoLayout have changed.
|
||||||
|
---
|
||||||
|
clutter/clutter/clutter-text.c | 43 ++++++++++++++++++++++++++----------------
|
||||||
|
1 file changed, 27 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
|
||||||
|
index 4828a4cbd..4a6a74a0c 100644
|
||||||
|
--- a/clutter/clutter/clutter-text.c
|
||||||
|
+++ b/clutter/clutter/clutter-text.c
|
||||||
|
@@ -4511,6 +4511,27 @@ buffer_deleted_text (ClutterTextBuffer *buffer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+clutter_text_queue_redraw_or_relayout (ClutterText *self)
|
||||||
|
+{
|
||||||
|
+ ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||||
|
+ gfloat preferred_width;
|
||||||
|
+ gfloat preferred_height;
|
||||||
|
+
|
||||||
|
+ clutter_text_dirty_cache (self);
|
||||||
|
+
|
||||||
|
+ /* we're using our private implementations here to avoid the caching done by ClutterActor */
|
||||||
|
+ clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
|
||||||
|
+ clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
||||||
|
+
|
||||||
|
+ if (clutter_actor_has_allocation (actor) &&
|
||||||
|
+ (fabsf (preferred_width - clutter_actor_get_width (actor)) > 0.001 ||
|
||||||
|
+ fabsf (preferred_height - clutter_actor_get_height (actor)) > 0.001))
|
||||||
|
+ clutter_actor_queue_relayout (actor);
|
||||||
|
+ else
|
||||||
|
+ clutter_text_queue_redraw (actor);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
buffer_notify_text (ClutterTextBuffer *buffer,
|
||||||
|
GParamSpec *spec,
|
||||||
|
@@ -4518,9 +4539,7 @@ buffer_notify_text (ClutterTextBuffer *buffer,
|
||||||
|
{
|
||||||
|
g_object_freeze_notify (G_OBJECT (self));
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
-
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
|
||||||
|
g_signal_emit (self, text_signals[TEXT_CHANGED], 0);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT]);
|
||||||
|
@@ -4872,8 +4891,7 @@ clutter_text_set_cursor_visible (ClutterText *self,
|
||||||
|
{
|
||||||
|
priv->cursor_visible = cursor_visible;
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_VISIBLE]);
|
||||||
|
}
|
||||||
|
@@ -5774,9 +5792,7 @@ clutter_text_set_line_alignment (ClutterText *self,
|
||||||
|
{
|
||||||
|
priv->alignment = alignment;
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
-
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_ALIGNMENT]);
|
||||||
|
}
|
||||||
|
@@ -5831,9 +5847,7 @@ clutter_text_set_use_markup (ClutterText *self,
|
||||||
|
if (setting)
|
||||||
|
clutter_text_set_markup_internal (self, text);
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
-
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -5880,9 +5894,7 @@ clutter_text_set_justify (ClutterText *self,
|
||||||
|
{
|
||||||
|
priv->justify = justify;
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
-
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_JUSTIFY]);
|
||||||
|
}
|
||||||
|
@@ -6449,8 +6461,7 @@ clutter_text_set_preedit_string (ClutterText *self,
|
||||||
|
priv->preedit_set = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- clutter_text_dirty_cache (self);
|
||||||
|
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
+ clutter_text_queue_redraw_or_relayout (self);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -3,7 +3,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
|
|||||||
|
|
||||||
SRC_URI[archive.md5sum] = "7a3baf2fbb02f9cc341bf0424a31d0d2"
|
SRC_URI[archive.md5sum] = "7a3baf2fbb02f9cc341bf0424a31d0d2"
|
||||||
SRC_URI[archive.sha256sum] = "58fffc8025f21fb6da27bd2189b6db4d20c54f950b1a46aa7f7cbf0a82d386b0"
|
SRC_URI[archive.sha256sum] = "58fffc8025f21fb6da27bd2189b6db4d20c54f950b1a46aa7f7cbf0a82d386b0"
|
||||||
SRC_URI_append = " file://0001-remove-check-for-zenity.patch file://startup-notification.patch"
|
SRC_URI_append = "\
|
||||||
|
file://0001-remove-check-for-zenity.patch \
|
||||||
|
file://0002-avoid-unnecessary-relayouts-in-cluttertext.patch \
|
||||||
|
file://startup-notification.patch \
|
||||||
|
"
|
||||||
|
|
||||||
DEPENDS = "libxrandr libsm libx11 libxi glib-2.0 wayland-protocols libwacom mesa gtk+3 pango cairo gsettings-desktop-schemas xcomposite upower gnome-desktop libxkbfile json-glib wayland-native xinerama zenity libinput libcanberra"
|
DEPENDS = "libxrandr libsm libx11 libxi glib-2.0 wayland-protocols libwacom mesa gtk+3 pango cairo gsettings-desktop-schemas xcomposite upower gnome-desktop libxkbfile json-glib wayland-native xinerama zenity libinput libcanberra"
|
||||||
RDEPENDS_${PN} = "zenity"
|
RDEPENDS_${PN} = "zenity"
|
||||||
|
Loading…
Reference in New Issue
Block a user