aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZufu Liu <unknown>2025-01-07 09:23:31 +1100
committerZufu Liu <unknown>2025-01-07 09:23:31 +1100
commit8cb01625f379c89cd59b25750570fc190140ee61 (patch)
tree90a6ad8606987ea5b2925deb0125233aa07e99fe /src
parent4328a9ee4934d421709c9c1d394590610ea62e5d (diff)
downloadscintilla-mirror-8cb01625f379c89cd59b25750570fc190140ee61.tar.gz
Feature [feature-requests:#1539]. Avoid calling UpdateBidiData for each subline.
Remove vector of draw phases.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index bae7ab233..8215f7b68 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -2530,19 +2530,13 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V
Sci::Line lineDocPrevious = -1; // Used to avoid laying out one document line multiple times
std::shared_ptr<LineLayout> ll;
- std::vector<DrawPhase> phases;
+ DrawPhase phase = DrawPhase::all;
if ((phasesDraw == PhasesDraw::Multiple) && !bufferedDraw) {
- for (DrawPhase phase = DrawPhase::back; phase <= DrawPhase::carets; phase = static_cast<DrawPhase>(static_cast<int>(phase) * 2)) {
- phases.push_back(phase);
- }
- } else {
- phases.push_back(DrawPhase::all);
+ phase = DrawPhase::back;
}
- for (const DrawPhase &phase : phases) {
- int ypos = 0;
- if (!bufferedDraw)
- ypos += screenLinePaintFirst * vsDraw.lineHeight;
+ for (;;) {
int yposScreen = screenLinePaintFirst * vsDraw.lineHeight;
+ int ypos = bufferedDraw ? 0 : yposScreen;
Sci::Line visibleLine = model.TopLineOfMain() + screenLinePaintFirst;
while (visibleLine < model.pcs->LinesDisplayed() && yposScreen < rcArea.bottom) {
@@ -2561,6 +2555,10 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V
ll = RetrieveLineLayout(lineDoc, model);
LayoutLine(model, surface, vsDraw, ll.get(), model.wrapWidth);
lineDocPrevious = lineDoc;
+ if (ll && model.BidirectionalEnabled()) {
+ // Fill the line bidi data
+ UpdateBidiData(model, vsDraw, ll.get());
+ }
}
#if defined(TIME_PAINTING)
durLayout += ep.Duration(true);
@@ -2588,11 +2586,6 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V
surface->FillRectangleAligned(rcSpacer, Fill(vsDraw.styles[StyleDefault].back));
}
- if (model.BidirectionalEnabled()) {
- // Fill the line bidi data
- UpdateBidiData(model, vsDraw, ll.get());
- }
-
DrawLine(surface, model, vsDraw, ll.get(), lineDoc, visibleLine, xStart, rcLine, subLine, phase);
#if defined(TIME_PAINTING)
durPaint += ep.Duration(true);
@@ -2631,6 +2624,11 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V
yposScreen += vsDraw.lineHeight;
visibleLine++;
}
+
+ if (phase >= DrawPhase::carets) {
+ break;
+ }
+ phase = static_cast<DrawPhase>(static_cast<int>(phase) * 2);
}
ll.reset();
#if defined(TIME_PAINTING)