On Fri, Dec 30, 2005 at 12:00:13AM +0100, Lars Gullik Bjønnes wrote:
> Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> | Attached, finally, the corrected version of the patch using crc32. Turns
> | out y isn't needed here after all.
> 
> Any noticble speed difference?

Not for me... Bennett? I would be surprised if there were.
 
...

> | +           // Row signature; has row changed since last paint?
> | +           boost::crc_32_type crc;
> | +           for (lyx::pos_type i = rit->pos(); i < rit->endpos(); ++i) {
> | +                   const unsigned char b[] = { par.getChar(i) };
> | +                   crc.process_bytes(b, 1);
> | +           }                   
> | +           lyx::size_type const row_sig = crc.checksum();
> 
> Please refactor a bit:
> 
> lyx::size_type calculateRowSignature(Row const & row)
> {
>       boost::crc_32_type crc;
>       for (lyx::pos_type i = row.pos(); i < row.endpos(); ++i) {
>               const unsigned char b[] = { par.getChar(i) };
>               crc.process_bytes(b, 1);
>       }                   
>       return crc.checksum();
> }
> 
> lyx::size_type const row_sig = calculateRowSignagure(*rit);

OK. Don't you think BTW that 
const unsigned char b[] = { par.getChar(i) }; 
is ugly? Do you know a better way?

> | +
> | +           // The following code figures out if the cursor is inside
> | +           // an inset _on this row_.
> | +           bool cur_in_inset_in_row(false);
> | +           InsetList::const_iterator ii = par.insetlist.begin();
> | +           InsetList::const_iterator iend = par.insetlist.end();
> | +           for ( ; ii != iend; ++ii) {
> | +                   if (ii->pos >= rit->pos() && ii->pos < rit->endpos()
> | +                       && ii->inset->isTextInset() 
> | +                       && pi.base.bv->cursor().isInside(ii->inset))
> | +                           cur_in_inset_in_row = true;
> | +                           break;
> | +           }
> 
> This one as well.

OK

- Martin
 

Attachment: pgpDYgOSg7I7G.pgp
Description: PGP signature

Reply via email to