Re: [PATCH] Icon view RTL layout

Am Freitag, den 03.03.2006, 14:15 +0100 schrieb Alexander Larsson:
> 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.

As I explained in my other email doing it twice is required for making
mixed LTR/RTL environments work. Therefore, we can't rely on the
internal PangoLayout caching mechanism and have to determine ourselves
whether the layout dimensions we have are dirty.

Christian Neumair <chris gnome-de org>

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