mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2026-04-20 03:16:54 +00:00
rewrite GS/OS Console.
git-svn-id: svn://qnap.local/TwoTerm/branches/fix-gno-scrolling-region@3169 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
+13
-7
@@ -89,24 +89,30 @@ void Screen::putc(uint8_t c, iPoint cursor, uint8_t flags)
|
||||
#pragma mark -
|
||||
#pragma mark Erase
|
||||
|
||||
void Screen::eraseScreen()
|
||||
{
|
||||
void Screen::eraseScreen() { fillScreen(char_info()); }
|
||||
void Screen::eraseRect(iRect rect) { fillRect(rect, char_info()); }
|
||||
|
||||
|
||||
void Screen::fillScreen(char_info ci) {
|
||||
|
||||
for (auto &line : _screen) {
|
||||
std::fill(line.begin(), line.end(), char_info());
|
||||
std::fill(line.begin(), line.end(), ci);
|
||||
}
|
||||
_updates.push_back(iPoint(0,0));
|
||||
_updates.push_back(iPoint(width() - 1, height() - 1));
|
||||
}
|
||||
|
||||
|
||||
void Screen::eraseRect(iRect rect) {
|
||||
|
||||
|
||||
|
||||
|
||||
void Screen::fillRect(iRect rect, char_info ci) {
|
||||
|
||||
rect = rect.intersection(_frame);
|
||||
|
||||
if (!rect.valid()) return;
|
||||
|
||||
if (rect == _frame) return eraseScreen();
|
||||
if (rect == _frame) return fillScreen(ci);
|
||||
|
||||
auto yIter = _screen.begin() + rect.origin.y;
|
||||
auto yEnd = yIter + rect.size.height;
|
||||
@@ -116,7 +122,7 @@ void Screen::eraseRect(iRect rect) {
|
||||
auto xIter = line.begin() + rect.origin.x;
|
||||
auto xEnd = xIter + rect.size.width;
|
||||
|
||||
std::fill(xIter, xEnd, char_info());
|
||||
std::fill(xIter, xEnd, ci);
|
||||
}
|
||||
_updates.push_back(rect.origin);
|
||||
_updates.push_back(iPoint(rect.maxX()-1, rect.maxY()-1));
|
||||
|
||||
@@ -101,6 +101,9 @@ public:
|
||||
void eraseScreen();
|
||||
void eraseRect(iRect rect);
|
||||
|
||||
void fillScreen(char_info ci);
|
||||
void fillRect(iRect rect, char_info ci);
|
||||
|
||||
|
||||
void scrollUp();
|
||||
void scrollUp(iRect window);
|
||||
@@ -187,6 +190,9 @@ inline int Screen::width() const
|
||||
|
||||
inline void Screen::setCursor(iPoint point)
|
||||
{
|
||||
if (point.x >= _frame.width()) point.x = _frame.width() - 1;
|
||||
if (point.y >= _frame.height()) point.y = _frame.height() - 1;
|
||||
|
||||
_cursor = point;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user