The SinglePar update flags has been a no-op for a long time without
naybody noticing. This means that the current paragraph was
always rebroken and redrawn, even when only moving the cursor around.
Now we only do that when Update::SinglePar has been specified. This
means that there may be cases where update will not be correct
anymore, because this flag has not been specified. These places will
have to be found and fixed.
Update PAINTING_ANALYSIS.
This computation did not make sense anymore since we began to put the
contents in the Row object. The fact that it worked was a coincidence.
Instead, we set rows as changed() on creation and reset that once they
have been drawn. This will allow in the future for a finer definition
of what to redraw or not.
Also update the PAINTING_ANALYSIS document
The goal of this commit is to ensure that a processUpdateFlags call
that requires no redraw will not override a previous one that did
require a redraw.
To this end, the semantics of the flag argument is now different: its
value is now OR'ed with a private update_flags_ variable. This
variable is only reset after the buffer view has actually been
redrawn.
A new Update::ForceRedraw flag has been added. It requires a full
redraw but no metrics computation. It is not used in the main code
(yet), but avoids to compute metrics repeatedly in consecutive
processUpdateFlags calls.
The process is now as follows:
- if flags is just None, return immediately, there is nothing to do.
- the Force flag is honored (full metrics computation) and replaced
with ForceDraw.
- the FitCursor flag is honored and removed from the flags.
- the SinglePar update is added if ForceDraw is not in flags and only
the current par has been modified.
The remaining flags are only then added to the BufferView update
flags, and the update strategy is computed for the next paint event.
Finally the dubious call to updateMacros in updateMetrics has been
removed for performance reasons.
The goal of this commit is to ensure that a processUpdateFlags call
that requires no redraw will not override a previous one that did
require a redraw.
To this end, the semantics of the flag argument is now different: its
value is now OR'ed with a private update_flags_ variable. This
variable is only reset after the buffer view has actually been
redrawn.
A new Update::ForceRedraw flag has been added. It requires a full
redraw but no metrics computation. It is not used in the main code
(yet), but avoids to compute metrics repeatedly in consecutive
processUpdateFlags calls.
Finally the dubious call to updateMacros in updateMetrics has been
removed for performance reasons.
This allows to somewhat simplify the text and avoid some uses of
Paragraph (in the long term, RowPainter should not have to access
these things).
At the same time do a small cleanup to RowPainter: rename
text_metrics_ to tm_, remove pm_ and width_.
The new functions parBottomSpaging and parTopSapcing return below/above each paragraph.
This allows to remove the TopBottomSpace argument and makes the code a
bit clearer.
Now that Row has a pit() member, it is possible to use it instead of passing an extra pit_type parameter to a function which already has access to a Row.
Change the various paint* helpers to take a single row element as argument.
Do not update x_ in the various paint* helpers. Constify them. Update x_ in paintText and paintOnlyInsets instead.
Remove an empty call to paintForeignMark in paintInset (the call did nothing since orig_x == x_ at this point).
It is actually easier to set the 20 pixels margin in redoParagraph, since it is not necessary to take newlines in account when deciding what is the real last row of the paragraph.
Moreover this solves the following bug (present in 2.1.x too): when the document ends with a newling, the bottom margin disappears.
Update PAINTING_ANALYSIS with new tasks.
* remove optional arguments to the helpers that use a FontInfo
* add a textwidth argument to the text() methods that are used by rowpainter.
Now textwidth is only computed if a null value was passed to the
text() method. This means that in the use case of rowpainter, no
textwidth needs to be computed.
We already have a CoordCache of insets dimensions. It is not necessary
to store the same information in two places.
Give a name to CoordCache tables types to improve code readability.
Remove ParagraphMetrics::singleWidth, which is not used anymore.
This is a work in progress intended to start collective work towards improving the performance of our painting process.
The intent is to make it a living document that is updated as code evolves.