--- nono/vm/renderer.cpp 2026/04/29 17:05:54 1.1.1.15 +++ nono/vm/renderer.cpp 2026/04/29 17:05:59 1.1.1.16 @@ -22,11 +22,11 @@ #include "stopwatch.h" static Stopwatch sw_notify; static uint64 last_report_rtime; -static uint64 notify_time; +static uint64 notify_nsec; static uint notify_count; -static uint64 render_time; -static uint64 stretch_time; -static uint64 convert_time; +static uint64 render_nsec; +static uint64 stretch_nsec; +static uint64 convert_nsec; static uint convert_count; #endif @@ -40,7 +40,7 @@ VideoRenderer::VideoRenderer() AddAlias("Renderer"); monitor = gMonitorManager->Regist(ID_MONITOR_RENDERER, this); - monitor->func = ToMonitorCallback(&VideoRenderer::MonitorUpdate); + monitor->SetCallback(&VideoRenderer::MonitorScreen); monitor->SetSize(42, 10); } @@ -211,7 +211,7 @@ VideoRenderer::DoRender(uint32 req) #if defined(PERFREND) sw_notify.Stop(); - notify_time += sw_notify.Elapsed(); + notify_nsec += sw_notify.Elapsed_nsec(); notify_count++; sw.Restart(); @@ -220,7 +220,7 @@ VideoRenderer::DoRender(uint32 req) updated = RenderMD(); #if defined(PERFREND) sw.Stop(); - render_time += sw.Elapsed(); + render_nsec += sw.Elapsed_nsec(); #endif stat_render_count++; } @@ -276,7 +276,7 @@ VideoRenderer::DoRender(uint32 req) } #if defined(PERFREND) sw.Stop(); - stretch_time += sw.Elapsed(); + stretch_nsec += sw.Elapsed_nsec(); #endif // wxWidgets 用の RGBX→RGB 変換。 @@ -287,7 +287,7 @@ VideoRenderer::DoRender(uint32 req) bitmap24_valid = true; #if defined(PERFREND) sw.Stop(); - convert_time += sw.Elapsed(); + convert_nsec += sw.Elapsed_nsec(); convert_count++; #endif @@ -315,28 +315,28 @@ VideoRenderer::PrintPerf() } double rate = 0; - uint nt = 0; - uint rt = 0; - uint st = 0; - uint ct = 0; + uint nt_usec = 0; + uint rt_usec = 0; + uint st_usec = 0; + uint ct_usec = 0; if (notify_count != 0) { rate = (double)notify_count * 1_sec / (now - last_report_rtime); - nt = notify_time / notify_count / 1000U; - rt = render_time / notify_count / 1000U; + nt_usec = nsec_to_usec(notify_nsec) / notify_count; + rt_usec = nsec_to_usec(render_nsec) / notify_count; } if (convert_count != 0) { - st = stretch_time / convert_count / 1000U; - ct = convert_time / convert_count / 1000U; + st_usec = nsec_to_usec(stretch_nsec) / convert_count; + ct_usec = nsec_to_usec(convert_nsec) / convert_count; } printf( "%5.1f calls/s: Notify %u us, Render %u us, Stretch %u us, Convert %u us\n", - rate, nt, rt, st, ct); + rate, nt_usec, rt_usec, st_usec, ct_usec); - notify_time = 0; - render_time = 0; - stretch_time = 0; - convert_time = 0; + notify_nsec = 0; + render_nsec = 0; + stretch_nsec = 0; + convert_nsec = 0; notify_count = 0; convert_count = 0; last_report_rtime = now; @@ -366,16 +366,16 @@ VideoRenderer::ResizeView(uint width_, u cv.notify_one(); } -// 描画更新(通知)間隔を設定 +// 描画更新(通知)間隔を設定。[msec] で指定。 void -VideoRenderer::SetRefreshInterval(uint64 t) +VideoRenderer::SetRefreshInterval(uint64 msec) { - refresh_interval = t; + refresh_interval = msec_to_tsec(msec); } // モニタ更新 void -VideoRenderer::MonitorUpdate(Monitor *, TextScreen& screen) +VideoRenderer::MonitorScreen(Monitor *, TextScreen& screen) { int x; int y; @@ -504,8 +504,8 @@ LunaVideoRenderer::RenderMD() ConsoleRenderer::ConsoleRenderer() { // 視認性のためフチを追加。 - width = 640 + Padding * 2; - height = 480 + Padding * 2; + width = (80 * 8) + Padding * 2; + height = (24 * 16) + Padding * 2; bitmap.Create(width, height); }