[clutter] text: Style cleanups
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] text: Style cleanups
- Date: Tue, 7 Feb 2012 12:06:08 +0000 (UTC)
commit 15441bb28029d3d328c4a450a384fa822c5fd023
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Feb 7 11:31:28 2012 +0000
text: Style cleanups
Inline wrapper functions, and remove deep nested if's.
clutter/clutter-text.c | 70 +++++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 33 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index a34e87a..323f0b1 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -266,7 +266,7 @@ static void buffer_connect_signals (ClutterText *self);
static void buffer_disconnect_signals (ClutterText *self);
static ClutterTextBuffer *get_buffer (ClutterText *self);
-static void
+static inline void
clutter_text_dirty_paint_volume (ClutterText *text)
{
ClutterTextPrivate *priv = text->priv;
@@ -278,7 +278,7 @@ clutter_text_dirty_paint_volume (ClutterText *text)
}
}
-static void
+static inline void
clutter_text_queue_redraw (ClutterActor *self)
{
/* This is a wrapper for clutter_actor_queue_redraw that also
@@ -387,53 +387,57 @@ clutter_text_get_display_text (ClutterText *self)
}
}
-static void
+static inline void
clutter_text_ensure_effective_attributes (ClutterText *self)
{
ClutterTextPrivate *priv = self->priv;
/* If we already have the effective attributes then we don't need to
do anything */
- if (priv->effective_attrs == NULL)
+ if (priv->effective_attrs != NULL)
+ return;
+
+ /* same as if we don't have any attribute at all */
+ if (priv->attrs == NULL && priv->markup_attrs == NULL)
+ return;
+
+ if (priv->attrs != NULL)
{
- if (priv->attrs != NULL)
+ /* If there are no markup attributes then we can just use
+ these attributes directly */
+ if (priv->markup_attrs == NULL)
+ priv->effective_attrs = pango_attr_list_ref (priv->attrs);
+ else
{
- /* If there are no markup attributes then we can just use
- these attributes directly */
- if (priv->markup_attrs == NULL)
- priv->effective_attrs = pango_attr_list_ref (priv->attrs);
- else
- {
- /* Otherwise we need to merge the two lists */
- PangoAttrIterator *iter;
- GSList *attributes, *l;
-
- priv->effective_attrs = pango_attr_list_copy (priv->markup_attrs);
+ /* Otherwise we need to merge the two lists */
+ PangoAttrIterator *iter;
+ GSList *attributes, *l;
- iter = pango_attr_list_get_iterator (priv->attrs);
- do
- {
- attributes = pango_attr_iterator_get_attrs (iter);
+ priv->effective_attrs = pango_attr_list_copy (priv->markup_attrs);
- for (l = attributes; l != NULL; l = l->next)
- {
- PangoAttribute *attr = l->data;
+ iter = pango_attr_list_get_iterator (priv->attrs);
+ do
+ {
+ attributes = pango_attr_iterator_get_attrs (iter);
- pango_attr_list_insert (priv->effective_attrs, attr);
- }
+ for (l = attributes; l != NULL; l = l->next)
+ {
+ PangoAttribute *attr = l->data;
- g_slist_free (attributes);
+ pango_attr_list_insert (priv->effective_attrs, attr);
}
- while (pango_attr_iterator_next (iter));
- pango_attr_iterator_destroy (iter);
+ g_slist_free (attributes);
}
+ while (pango_attr_iterator_next (iter));
+
+ pango_attr_iterator_destroy (iter);
}
- else if (priv->markup_attrs != NULL)
- {
- /* We can just use the markup attributes directly */
- priv->effective_attrs = pango_attr_list_ref (priv->markup_attrs);
- }
+ }
+ else if (priv->markup_attrs != NULL)
+ {
+ /* We can just use the markup attributes directly */
+ priv->effective_attrs = pango_attr_list_ref (priv->markup_attrs);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]