[gtk] linedisplay: Save paragraph bg color inline
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] linedisplay: Save paragraph bg color inline
- Date: Sun, 21 Jul 2019 10:45:52 +0000 (UTC)
commit 2ca56d4c4c70a90b51680a5e564ee26eb5784219
Author: Timm Bäder <mail baedert org>
Date: Sun Jul 21 09:47:09 2019 +0200
linedisplay: Save paragraph bg color inline
No need to allocate this separately.
gtk/gtktextdisplay.c | 4 ++--
gtk/gtktextlayout.c | 14 ++++++++------
gtk/gtktextlayoutprivate.h | 3 ++-
3 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index de02bd3b47..9c2dae9e14 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -642,13 +642,13 @@ render_para (GtkTextRenderer *text_renderer,
}
else
{
- if (line_display->pg_bg_rgba)
+ if (line_display->pg_bg_rgba_set)
{
cairo_t *cr = text_renderer->cr;
cairo_save (cr);
- gdk_cairo_set_source_rgba (text_renderer->cr, line_display->pg_bg_rgba);
+ gdk_cairo_set_source_rgba (text_renderer->cr, &line_display->pg_bg_rgba);
cairo_rectangle (cr,
line_display->left_margin, selection_y,
screen_width, selection_height);
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index f941e33115..79785773d1 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1431,11 +1431,16 @@ set_para_values (GtkTextLayout *layout,
pango_layout_set_wrap (display->layout, pango_wrap);
}
display->total_width = MAX (layout->screen_width, layout->width) - h_margin - h_padding;
-
+
if (style->pg_bg_rgba)
- display->pg_bg_rgba = gdk_rgba_copy (style->pg_bg_rgba);
+ {
+ display->pg_bg_rgba = *style->pg_bg_rgba;
+ display->pg_bg_rgba_set = TRUE;
+ }
else
- display->pg_bg_rgba = NULL;
+ {
+ display->pg_bg_rgba_set = FALSE;
+ }
}
static PangoAttribute *
@@ -2630,9 +2635,6 @@ gtk_text_layout_free_line_display (GtkTextLayout *layout,
if (display->cursors)
g_array_free (display->cursors, TRUE);
- if (display->pg_bg_rgba)
- gdk_rgba_free (display->pg_bg_rgba);
-
g_slice_free (GtkTextLineDisplay, display);
}
}
diff --git a/gtk/gtktextlayoutprivate.h b/gtk/gtktextlayoutprivate.h
index 8f0b1895d9..8af8465349 100644
--- a/gtk/gtktextlayoutprivate.h
+++ b/gtk/gtktextlayoutprivate.h
@@ -246,7 +246,8 @@ struct _GtkTextLineDisplay
guint cursor_at_line_end : 1;
guint size_only : 1;
- GdkRGBA *pg_bg_rgba;
+ GdkRGBA pg_bg_rgba;
+ guint pg_bg_rgba_set : 1;
};
#ifdef GTK_COMPILATION
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]