[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: koffice/libs/kotext/styles
From:       Jos van den Oever <jos () vandenoever ! info>
Date:       2010-08-16 8:28:15
Message-ID: 201008161346.16028.jos () vandenoever ! info
[Download RAW message or body]

On Monday, August 16, 2010 03:15:50 am Thomas Zander wrote:
> On Sunday 15. August 2010 12.25.14 Jos van den Oever wrote:
> > Avoid doing too many style merges.
> > 
> > Doing this:
> >  QCharTextFormat format;
> >  applyStyle(format);
> >  cursor.mergeCharFormat(format);
> > 
> > is equivalent to:
> >  QCharTextFormat format = cursor.charFormat();
> >  applyStyle(format);
> >  cursor.setCharFormat(format);
> > 
> > and avoids an expensive merging step.
> > 
> > This gives a speedup of loading of text-heavy file by about 14%.
> > 
> >  M  +17 -15    KoCharacterStyle.cpp
> 
> No, its not equivalent.
> Your second version assumes that over the whole area only one format is
> used, if more than one format is used you need to merge.
> The second version would loose all the formatting data of text after the
> cursor position.
> 
> i.e.   <p>foo<b>bar</b>baz</p>  would become <p><i>foobarbaz</p> if you add
> italic. I.e. the second fragment with bold looses its format.

You are right. There is no simple solution to this so I will revert the patch.

Cheers,
Jos
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic