From 014705c740065865e1fae9c1a1e9862c0197684f Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 18 Jan 2019 10:41:05 -0600 Subject: [PATCH] elm_code: Pass widget data to _elm_code_widget_fill_line We already have this looked up in all callers, and the lookup is mind smashingly heavy. Just use what we have. ref T6209 Signed-off-by: Derek Foreman Reviewed-by: Chris Michael Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D7694 --- src/lib/elementary/elm_code_widget.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 39a1ee162e..265624778f 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -385,7 +385,7 @@ _elm_code_widget_fill_selection(Elm_Code_Widget *widget, Elm_Code_Line *line, Ev } static void -_elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line) +_elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, Elm_Code_Line *line) { char *chr; Eina_Unicode unichr; @@ -393,11 +393,9 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line) int chrpos, gutter; Evas_Object *grid; Evas_Textgrid_Cell *cells; - Elm_Code_Widget_Data *pd; EINA_SAFETY_ON_NULL_RETURN(line); - pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); if (eina_list_count(pd->grids) < line->number) return; @@ -409,7 +407,6 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line) length = elm_code_widget_line_text_column_width_get(widget, line); chrpos = 0; chr = (char *)elm_code_line_text_get(line, NULL); - for (x = gutter; x < (unsigned int) w && x < length + gutter; x+=charwidth) { unichr = eina_unicode_utf8_next_get(chr, &chrpos); @@ -477,7 +474,7 @@ _elm_code_widget_fill_range(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, unsigned int y; if (newline) - _elm_code_widget_fill_line(widget, newline); + _elm_code_widget_fill_line(widget, pd, newline); // if called from new line cb, no need to update whole range unless visible if (newline && !elm_obj_code_widget_line_visible_get(widget, newline)) @@ -491,7 +488,7 @@ _elm_code_widget_fill_range(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, line = elm_code_file_line_get(pd->code->file, y); if (line) - _elm_code_widget_fill_line(widget, line); + _elm_code_widget_fill_line(widget, pd, line); } if (pd->selection) @@ -714,7 +711,7 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, if (oldrow != pd->cursor_line) _elm_code_widget_refresh(widget, line_obj); else - _elm_code_widget_fill_line(widget, elm_code_file_line_get(pd->code->file, pd->cursor_line)); + _elm_code_widget_fill_line(widget, pd, elm_code_file_line_get(pd->code->file, pd->cursor_line)); elm_layout_signal_emit(pd->cursor_rect, "elm,action,show,cursor", "elm"); } @@ -2080,9 +2077,9 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) } EOAPI void -_elm_code_widget_line_refresh(Eo *obj, Elm_Code_Widget_Data *pd EINA_UNUSED, Elm_Code_Line *line) +_elm_code_widget_line_refresh(Eo *obj, Elm_Code_Widget_Data *pd, Elm_Code_Line *line) { - _elm_code_widget_fill_line(obj, line); + _elm_code_widget_fill_line(obj, pd, line); } EOAPI Eina_Bool