26/07/2013 10:54, Jean-Marc Lasgouttes:

I continue my backwards visit of history.

I forgot a couple of remarks in this commit.

-               RowPainter rp(pi, *text_, pit, row, bidi, x, y);
+
+               cur.setTargetX();

Do you really need to set targetX? This seems plain wrong to me since, if it was set to some useful value, you are just killing this value.

+               BufferView & bv = cur.bv();
+

You are defining bv, whereas you already have bv_, which is a BufferView const *. Advice: always check whether a variable is needed before defining it.

However in this case the situation is different since you want a non-const cursor. A way to have is is to get a non-const BufferView. It often happens in such methods that extra data is provided in ancillary parameters, in this case pi (PainterInfo).

In particular in pi you have pi.bv, which is a pointer to the buffer view. Therefore you can change the definition of cur to
        Cursor & cur = pi.bv.cursor();

Normally, with this you will be able to get rid of const_cast<> in Cursor class.

JMarc

Reply via email to