[gnome-builder/wip/gtk4-port: 422/1774] libide/sourceview: short-circuit if no classes are set
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 422/1774] libide/sourceview: short-circuit if no classes are set
- Date: Mon, 11 Jul 2022 22:31:11 +0000 (UTC)
commit 4dadc64da9deddda6c9e71a7b82800f60cc47148
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 6 14:07:50 2022 -0700
libide/sourceview: short-circuit if no classes are set
This just helps reduce how many quark queries we make during the line
snapshot.
src/libide/sourceview/ide-line-change-gutter-renderer.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/sourceview/ide-line-change-gutter-renderer.c
b/src/libide/sourceview/ide-line-change-gutter-renderer.c
index 675682ee9..fe20cb61f 100644
--- a/src/libide/sourceview/ide-line-change-gutter-renderer.c
+++ b/src/libide/sourceview/ide-line-change-gutter-renderer.c
@@ -244,13 +244,20 @@ ide_line_change_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer
guint line)
{
IdeLineChangeGutterRenderer *self = (IdeLineChangeGutterRenderer *)renderer;
- gboolean is_add = gtk_source_gutter_lines_has_qclass (lines, line, added_quark);
- gboolean is_change = gtk_source_gutter_lines_has_qclass (lines, line, changed_quark);
- gboolean is_delete = gtk_source_gutter_lines_has_qclass (lines, line, deleted_quark);
+ gboolean is_add;
+ gboolean is_change;
+ gboolean is_delete;
int line_y;
int line_height;
int width;
+ if (!gtk_source_gutter_lines_has_any_class (lines, line))
+ return;
+
+ is_add = gtk_source_gutter_lines_has_qclass (lines, line, added_quark);
+ is_change = gtk_source_gutter_lines_has_qclass (lines, line, changed_quark);
+ is_delete = gtk_source_gutter_lines_has_qclass (lines, line, deleted_quark);
+
if (!is_add && !is_change && !is_delete)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]