Re: [PATCH] Icon view RTL layout
- From: Alexander Larsson <alexl redhat com>
- To: Christian Neumair <chris gnome-de org>
- Cc: nautilus-list gnome org
- Subject: Re: [PATCH] Icon view RTL layout
- Date: Fri, 03 Mar 2006 14:15:54 +0100
On Fri, 2006-03-03 at 13:06 +0100, Christian Neumair wrote:
>
> Now this is a bad situation. Making the RTL layout work without major
> performance impact on LTR requires some more caching, which in turn
> requires moving around some code, which bloats the diffs and will lead
> to huge patches, like that one I'm attaching now.
>
> The "icon_width" changes were just removal of unneeded/unused code, the
> rest is hopefully traceable enough. I think it even improves performance
> by not measuring the label width before drawing if it's already
> measured.
>
> This should have been done by splitting up measure and draw into their
> own helpers, but this would have made the diff even longer (I'll
> definitly cook a patch for 2.15).
>
> In text besides icon mode, this still causes two pango_layout_set_width
> calls but they're guaranteed to be done only *once* for an item as long
> as its text is valid. From reading the old code, the drawing code always
> measured the text width, which probably was a performance bottleneck.
I don't think you understand how PangoLayout works. You set a bunch of
settings in it, like the text, and the line-break width. When this is
done you can then ask it for things like pixel size and you can paint
it. When you do this the first time the text has to be analyzed,
line-broken etc. Once this is done you can get e.g. the width multiple
times without extra costs. The only expensive operation is setting any
of the settings that affect the layout (for instance the width), because
then all the previous layout work is thrown away and redone.
So, your code will for the initial load of a directory with
text-besides-icons always first get the pixel size (which causes a
layout), and then set the width, throwing away the layout results. So
each filename will still be layed out twice.
Splitting up drawing and measurment seems like a very bad idea, as that
will always cause us to do the layout twice. The reason its done in one
place is to avoid that.
What exactly is it that causes the problem in RTL mode? There must be a
better solution than changing the width of the layout.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a lonely alcoholic grifter in drag. She's a mentally unstable extravagent
college professor from the wrong side of the tracks. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]