• R/O
  • SSH
  • HTTPS

nos: Commit


Commit MetaInfo

Révision366 (tree)
l'heure2009-10-28 08:10:33
Auteuruchan_nos

Message de Log

コンソールのスクロールを高速化する試みをしたが、結局全消去と文字列描画の方式に落ち着いた

Change Summary

Modification

--- bitnos5/trunk/kernel/console.cpp (revision 365)
+++ bitnos5/trunk/kernel/console.cpp (revision 366)
@@ -16,6 +16,8 @@
1616 #include <bitnos/timer.h>
1717 #include <bitnos/specialtask.h>
1818
19+#define REFRESH_METHOD 0
20+
1921 namespace TaskConsole
2022 {
2123
@@ -152,10 +154,10 @@
152154 Debug::WriteLine("Console Init");
153155
154156 //o->cons.height = 10;
155- o->cons.height = 10;
157+ o->cons.height = 12;
156158 // o->cons.width = 29;
157- o->cons.width = 29;
158- o->cons.bufHeight = 20;
159+ o->cons.width = 34;
160+ //o->cons.bufHeight = 40;
159161 //o->cons.bufWidth = 29;
160162 o->cons.bufWidth = o->cons.width;
161163 o->cons.buf = new char[o->cons.bufHeight * o->cons.bufWidth];
@@ -168,7 +170,7 @@
168170 o->cursor = false;
169171 o->active = SpecialTask::Get(SpecialTask::Active) == task;
170172
171- o->cons.sbuf.Init(29, 20);
173+ o->cons.sbuf.Init(o->cons.width, 20);
172174 o->cons.wPos = Point(0, 0);
173175 o->cons.pPos = Point(0, 0);
174176
@@ -244,11 +246,42 @@
244246 o->cons.sbuf.Scroll(1);
245247 o->cons.sbuf.Write(Point(0, o->cons.sbuf.GetHeight() - 1), '\0');
246248 o->cmdlineBegin--;
249+
250+
247251 }
248252 o->cons.wPos.X = 0;
249253 o->cons.pPos.X = 0;
250254 if (o->cons.pPos.Y < o->cons.height - 1) {
251255 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
252285 }
253286 }
254287
@@ -358,8 +391,15 @@
358391 25 + 4 + fontHankaku->GetHeight() * (o->cons.pPos.Y + 1) - 1)
359392 );
360393 } else if (ch == '\n' || o->cons.wPos.X >= o->cons.sbuf.GetWidth()) {
394+ int pposy = o->cons.pPos.Y;
361395 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+
363403 } else {
364404 o->sht->DrawChar(
365405 o->cons.textColor,
@@ -564,8 +604,28 @@
564604 begin = 0;
565605 }
566606 }
607+
608+ /*
609+ int beginOld = begin - 1;
610+ if (beginOld < 0) {
611+ beginOld = 0;
612+ }
613+ */
614+
567615 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+
569629 for (int lines = 0; begin + lines <= o->cons.sbuf.GetHeight() && lines < o->cons.height; lines++) {
570630 o->img->DrawString(
571631 o->cons.textColor,
@@ -659,6 +719,14 @@
659719 PutString0(o, " tree \n");
660720 PutString0(o, " tree tree \n");
661721 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");
662730 } else {
663731 if (strlen(command) > 0) {
664732 PutString0(o, "unknown command\n");
Afficher sur ancien navigateur de dépôt.