Re: why there is not "pango_layout_iter_previous_line"
- From: "David E. Hollingsworth" <deh curl com>
- To: 王旭光 <ninesunqian 163 com>
- Cc: gtk-i18n-list <gtk-i18n-list gnome org>
- Subject: Re: why there is not "pango_layout_iter_previous_line"
- Date: 07 Aug 2009 10:00:20 -0700
=?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]