Re: why there is not "pango_layout_iter_previous_line"



=?gbk?B?zfXQ8bni?= <ninesunqian 163 com> writes:

> It is used when I scroll the text.  If I frequently call
> "pango_layout_get_line", is the efficiency very low ?

You probably want to be using pango_layout_get_line_readonly() unless
you're modifying the contents.  Otherwise it has to recalculate the
extents each time you ask.

Anyway, pango_layout_get_line() uses small a loop as you can get:

GSList*
g_slist_nth (GSList *list,
	     guint   n)
{
  while (n-- > 0 && list)
    list = list->next;

  return list;
}

I think you'll find that even with millions of elements that's not
enough time to matter.

Obviously it's possible to use this in slow ways:

pango_layout_get_line_readonly(1000);
pango_layout_get_line_readonly(999);
...

So don't do that.  Jump backwards then walk forwards.

  --deh!

-- 
"I've just found the silverware and I'm sticking a fork in that square!" - N.H.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]