コンソールのスクロールを高速化する試みをしたが、結局全消去と文字列描画の方式に落ち着いた
@@ -16,6 +16,8 @@ | ||
16 | 16 | #include <bitnos/timer.h> |
17 | 17 | #include <bitnos/specialtask.h> |
18 | 18 | |
19 | +#define REFRESH_METHOD 0 | |
20 | + | |
19 | 21 | namespace TaskConsole |
20 | 22 | { |
21 | 23 |
@@ -152,10 +154,10 @@ | ||
152 | 154 | Debug::WriteLine("Console Init"); |
153 | 155 | |
154 | 156 | //o->cons.height = 10; |
155 | - o->cons.height = 10; | |
157 | + o->cons.height = 12; | |
156 | 158 | // o->cons.width = 29; |
157 | - o->cons.width = 29; | |
158 | - o->cons.bufHeight = 20; | |
159 | + o->cons.width = 34; | |
160 | + //o->cons.bufHeight = 40; | |
159 | 161 | //o->cons.bufWidth = 29; |
160 | 162 | o->cons.bufWidth = o->cons.width; |
161 | 163 | o->cons.buf = new char[o->cons.bufHeight * o->cons.bufWidth]; |
@@ -168,7 +170,7 @@ | ||
168 | 170 | o->cursor = false; |
169 | 171 | o->active = SpecialTask::Get(SpecialTask::Active) == task; |
170 | 172 | |
171 | - o->cons.sbuf.Init(29, 20); | |
173 | + o->cons.sbuf.Init(o->cons.width, 20); | |
172 | 174 | o->cons.wPos = Point(0, 0); |
173 | 175 | o->cons.pPos = Point(0, 0); |
174 | 176 |
@@ -244,11 +246,42 @@ | ||
244 | 246 | o->cons.sbuf.Scroll(1); |
245 | 247 | o->cons.sbuf.Write(Point(0, o->cons.sbuf.GetHeight() - 1), '\0'); |
246 | 248 | o->cmdlineBegin--; |
249 | + | |
250 | + | |
247 | 251 | } |
248 | 252 | o->cons.wPos.X = 0; |
249 | 253 | o->cons.pPos.X = 0; |
250 | 254 | if (o->cons.pPos.Y < o->cons.height - 1) { |
251 | 255 | o->cons.pPos.Y++; |
256 | + } else { | |
257 | +#if REFRESH_METHOD == 1 | |
258 | + Point posTo(4, 25 + 4); | |
259 | + Point posFrom(4, 25 + 4 + fontHankaku->GetHeight()); | |
260 | + uint16_t* ptrTo; | |
261 | + uint16_t* ptrFrom; | |
262 | + //uint32_t* ptrTo; | |
263 | + //uint32_t* ptrFrom; | |
264 | + for (int y = 4; y < o->img->GetHeight() - 25 - fontHankaku->GetHeight(); y++) { | |
265 | + ptrTo = o->img->buf + posTo.Y * o->img->GetWidth() + 4; | |
266 | + ptrFrom = o->img->buf + posFrom.Y * o->img->GetWidth() + 4; | |
267 | + //ptrTo = (uint32_t*)(o->img->buf + posTo.Y * o->img->GetWidth() + 4); | |
268 | + //ptrFrom = (uint32_t*)(o->img->buf + posFrom.Y * o->img->GetWidth() + 4); | |
269 | + | |
270 | + //for (posFrom.X = 4, posTo.X = 4; posFrom.X < o->img->width - 4; posFrom.X++, posTo.X++) { | |
271 | + for (posFrom.X = 4; posFrom.X < o->img->width - 4; posFrom.X++) { | |
272 | + //o->img->DrawPoint(o->img->GetPoint(posFrom), posTo); | |
273 | + *ptrTo++ = *ptrFrom++; | |
274 | + } | |
275 | + posTo.Y++; | |
276 | + posFrom.Y++; | |
277 | + | |
278 | + } | |
279 | + posTo.X = 0; | |
280 | + o->img->DrawRectangleFill( | |
281 | + o->cons.backColor, posTo, Point(o->img->GetWidth() - 1, o->img->GetHeight() - 1)); | |
282 | + | |
283 | + o->sht->Refresh(); | |
284 | +#endif | |
252 | 285 | } |
253 | 286 | } |
254 | 287 |
@@ -358,8 +391,15 @@ | ||
358 | 391 | 25 + 4 + fontHankaku->GetHeight() * (o->cons.pPos.Y + 1) - 1) |
359 | 392 | ); |
360 | 393 | } else if (ch == '\n' || o->cons.wPos.X >= o->cons.sbuf.GetWidth()) { |
394 | + int pposy = o->cons.pPos.Y; | |
361 | 395 | NewLine(o); |
362 | - ConsoleRefreshScreen(o, -1); | |
396 | + | |
397 | +#if REFRESH_METHOD == 0 | |
398 | + if (pposy == o->cons.pPos.Y) { | |
399 | + ConsoleRefreshScreen(o, -1); | |
400 | + } | |
401 | +#endif | |
402 | + | |
363 | 403 | } else { |
364 | 404 | o->sht->DrawChar( |
365 | 405 | o->cons.textColor, |
@@ -564,8 +604,28 @@ | ||
564 | 604 | begin = 0; |
565 | 605 | } |
566 | 606 | } |
607 | + | |
608 | + /* | |
609 | + int beginOld = begin - 1; | |
610 | + if (beginOld < 0) { | |
611 | + beginOld = 0; | |
612 | + } | |
613 | + */ | |
614 | + | |
567 | 615 | o->img->DrawRectangleFill( |
568 | - o->cons.backColor, Point(0, 25), Point(o->img->width - 1, o->img->height - 1)); | |
616 | + o->cons.backColor, Point(4, 25 + 4), Point(o->img->GetWidth() - 1 - 4, o->img->GetHeight() - 1 - 4)); | |
617 | + | |
618 | +/* | |
619 | + for (int lines = 0; beginOld + lines <= o->cons.sbuf.GetHeight() && lines < o->cons.height; lines++) { | |
620 | + o->img->DrawString( | |
621 | + ConvRGB16(127, 127, 127), | |
622 | + o->cons.sbuf.GetPointer(Point(0, beginOld + lines)), | |
623 | + Point(4, 25 + 4 + lines * fontHankaku->GetHeight()), | |
624 | + fontHankaku); | |
625 | + } | |
626 | + */ | |
627 | + | |
628 | + | |
569 | 629 | for (int lines = 0; begin + lines <= o->cons.sbuf.GetHeight() && lines < o->cons.height; lines++) { |
570 | 630 | o->img->DrawString( |
571 | 631 | o->cons.textColor, |
@@ -659,6 +719,14 @@ | ||
659 | 719 | PutString0(o, " tree \n"); |
660 | 720 | PutString0(o, " tree tree \n"); |
661 | 721 | PutString0(o, "tree tree tree\n"); |
722 | + } else if (strncmp(command, "cat", 4) == 0) { | |
723 | + PutString0(o, " _ ___ _.--.\n"); | |
724 | + PutString0(o, " \\`.|\\..----...-'` `-._.-'_.-'`\n"); | |
725 | + PutString0(o, " / ' ` , __.--'\n"); | |
726 | + PutString0(o, " )/' _/ \\ `-_, /\n"); | |
727 | + PutString0(o, " `-'\" `\"\\_ ,_.-;_.-\\_ ',\n"); | |
728 | + PutString0(o, " _.-'_./ {_.' ; /\n"); | |
729 | + PutString0(o, " {_.-``-' {_/\n"); | |
662 | 730 | } else { |
663 | 731 | if (strlen(command) > 0) { |
664 | 732 | PutString0(o, "unknown command\n"); |