From 49ce0be914bcdeed23e7ac80e222e6a64555d0af Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Thu, 15 Oct 2020 00:07:36 +0200 Subject: [PATCH] FVTerm improvements --- src/fvterm.cpp | 14 +++++++------- src/include/final/fvterm.h | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/fvterm.cpp b/src/fvterm.cpp index e09d3f1d..80c1c39b 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -907,7 +907,7 @@ void FVTerm::getArea (const FPoint& pos, const FTermArea* area) for (int y{0}; y < y_end; y++) // line loop { - auto& tc = vterm->data[(ay + y) * vterm->width + ax]; // terminal character + const auto& tc = vterm->data[(ay + y) * vterm->width + ax]; // terminal character auto& ac = area->data[y * area->width]; // area character std::memcpy (&ac, &tc, sizeof(ac) * unsigned(length)); @@ -955,7 +955,7 @@ void FVTerm::getArea (const FRect& box, const FTermArea* area) for (int _y = 0; _y < y_end; _y++) // line loop { const int line_len = area->width + area->right_shadow; - auto& tc = vterm->data[(y + _y - 1) * vterm->width + x - 1]; // terminal character + const auto& tc = vterm->data[(y + _y - 1) * vterm->width + x - 1]; // terminal character auto& ac = area->data[(dy + _y) * line_len + dx]; // area character std::memcpy (&ac, &tc, sizeof(ac) * unsigned(length)); @@ -1138,7 +1138,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const { const int pos1 = y * total_width; const int pos2 = (y + 1) * total_width; - auto& sc = area->data[pos2]; // source character + const auto& sc = area->data[pos2]; // source character auto& dc = area->data[pos1]; // destination character std::memcpy (&dc, &sc, sizeof(dc) * unsigned(length)); area->changes[y].xmin = 0; @@ -1191,7 +1191,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const { const int pos1 = (y - 1) * total_width; const int pos2 = y * total_width; - auto& sc = area->data[pos1]; // source character + const auto& sc = area->data[pos1]; // source character auto& dc = area->data[pos2]; // destination character std::memcpy (&dc, &sc, sizeof(dc) * unsigned(length)); area->changes[y].xmin = 0; @@ -1477,7 +1477,7 @@ void FVTerm::updateOverlappedColor ( const FTermArea* area const int ty = terminal_pos.getY(); const int width = area->width + area->right_shadow; // Area character - auto& ac = area->data[y * width + x]; + const auto& ac = area->data[y * width + x]; // Terminal character auto& tc = vterm->data[ty * vterm->width + tx]; // New character @@ -1612,7 +1612,7 @@ bool FVTerm::updateVTermCharacter ( const FTermArea* area const int y = area_pos.getY(); const int width = area->width + area->right_shadow; // Area character - auto& ac = area->data[y * width + x]; + const auto& ac = area->data[y * width + x]; // Get covered state const auto is_covered = isCovered(terminal_pos, area); @@ -2742,7 +2742,7 @@ bool FVTerm::printWrap (FTermArea* area) const inline void FVTerm::printCharacterOnCoordinate ( FTermArea* area , const int& ax , const int& ay - , FChar& ch) + , const FChar& ch) const { if ( area->cursor_x <= 0 || area->cursor_y <= 0 diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 21357df3..88798fe9 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -407,7 +407,10 @@ class FVTerm bool isFullWidthPaddingChar (const FChar* const&) const; static void cursorWrap(); bool printWrap (FTermArea*) const; - void printCharacterOnCoordinate (FTermArea*, const int&, const int&, FChar&); + void printCharacterOnCoordinate ( FTermArea* + , const int& + , const int& + , const FChar&) const; void printPaddingCharacter (FTermArea*, const FChar&); void updateTerminalLine (uInt) const; bool updateTerminalCursor() const;