Move VideoRedrawScreen() to Video. (PR #904)

This commit is contained in:
Andrea 2021-01-01 12:42:24 +00:00 committed by GitHub
parent c7d9a780bb
commit 9d7aa7d309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 24 deletions

View file

@ -318,7 +318,7 @@ void CPageConfig::DlgOK(HWND hWnd)
GetVideo().VideoReinitialize(); GetVideo().VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
{ {
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
} }
} }

View file

@ -754,7 +754,7 @@ Update_t CmdBenchmarkStop (int nArgs)
DebugEnd(); DebugEnd();
GetFrame().FrameRefreshStatus(DRAW_TITLE); GetFrame().FrameRefreshStatus(DRAW_TITLE);
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
DWORD currtime = GetTickCount(); DWORD currtime = GetTickCount();
while ((extbench = GetTickCount()) != currtime) while ((extbench = GetTickCount()) != currtime)
; // intentional busy-waiting ; // intentional busy-waiting
@ -7447,7 +7447,7 @@ Update_t CmdWindowViewData (int nArgs)
//=========================================================================== //===========================================================================
Update_t CmdWindowViewOutput (int nArgs) Update_t CmdWindowViewOutput (int nArgs)
{ {
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
DebugVideoMode::Instance().Set( GetVideo().GetVideoMode() ); DebugVideoMode::Instance().Set( GetVideo().GetVideoMode() );

View file

@ -1,7 +1,6 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "FrameBase.h" #include "FrameBase.h"
#include "Interface.h"
FrameBase::FrameBase() FrameBase::FrameBase()
{ {
@ -16,9 +15,3 @@ FrameBase::~FrameBase()
{ {
} }
void FrameBase::VideoRedrawScreen(void)
{
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
GetVideo().VideoRefreshScreen(GetVideo().GetVideoMode(), true);
}

View file

@ -13,8 +13,6 @@ public:
BOOL g_bMultiMon; BOOL g_bMultiMon;
bool g_bFreshReset; bool g_bFreshReset;
void VideoRedrawScreen();
virtual void FrameDrawDiskLEDS(HDC hdc) = 0; virtual void FrameDrawDiskLEDS(HDC hdc) = 0;
virtual void FrameDrawDiskStatus(HDC hdc) = 0; virtual void FrameDrawDiskStatus(HDC hdc) = 0;
virtual void FrameRefreshStatus(int, bool bUpdateDiskStatus = true) = 0; virtual void FrameRefreshStatus(int, bool bUpdateDiskStatus = true) = 0;

View file

@ -303,7 +303,7 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
{ {
g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status
GetFrame().FrameRefreshStatus(DRAW_LEDS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode GetFrame().FrameRefreshStatus(DRAW_LEDS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode
GetFrame().VideoRedrawScreen(); // TODO: Still need to implement page mode switching and 'whatnot' GetVideo().VideoRedrawScreen(); // TODO: Still need to implement page mode switching and 'whatnot'
} }
return; return;
} }

View file

@ -97,7 +97,7 @@ static void Spkr_DSUninit();
static void DisplayBenchmarkResults () static void DisplayBenchmarkResults ()
{ {
DWORD totaltime = GetTickCount()-extbench; DWORD totaltime = GetTickCount()-extbench;
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
TCHAR buffer[64]; TCHAR buffer[64];
wsprintf(buffer, wsprintf(buffer,
TEXT("This benchmark took %u.%02u seconds."), TEXT("This benchmark took %u.%02u seconds."),

View file

@ -852,7 +852,7 @@ void Video::VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit
void Video::VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame) void Video::VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
{ {
NTSC_VideoClockResync(dwCyclesThisFrame); NTSC_VideoClockResync(dwCyclesThisFrame);
GetFrame().VideoRedrawScreen(); // Better (no flicker) than using: NTSC_VideoReinitialize() or VideoReinitialize() VideoRedrawScreen(); // Better (no flicker) than using: NTSC_VideoReinitialize() or VideoReinitialize()
} }
void Video::Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename) void Video::Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename)
@ -861,7 +861,7 @@ void Video::Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename)
if (!pScreenshotFilename) if (!pScreenshotFilename)
return; return;
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
Video_SaveScreenShot(SCREENSHOT_560x384, pScreenshotFilename); Video_SaveScreenShot(SCREENSHOT_560x384, pScreenshotFilename);
} }
@ -884,3 +884,9 @@ void Video::VideoRefreshScreen(uint32_t uRedrawWholeScreenVideoMode, bool bRedra
VideoPresentScreen(); VideoPresentScreen();
} }
void Video::VideoRedrawScreen(void)
{
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
VideoRefreshScreen(GetVideoMode(), true);
}

View file

@ -219,6 +219,7 @@ public:
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false); void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false);
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame); void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename); void Video_RedrawAndTakeScreenShot(const char* pScreenshotFilename);
void VideoRedrawScreen(void);
uint8_t* GetFrameBuffer(void) { return g_pFramebufferbits; } uint8_t* GetFrameBuffer(void) { return g_pFramebufferbits; }
void SetFrameBuffer(uint8_t* frameBuffer) { g_pFramebufferbits = frameBuffer; } void SetFrameBuffer(uint8_t* frameBuffer) { g_pFramebufferbits = frameBuffer; }

View file

@ -589,7 +589,7 @@ static void DrawFrameWindow (bool bPaintingWindow/*=false*/)
else if (g_nAppMode == MODE_DEBUG) else if (g_nAppMode == MODE_DEBUG)
DebugDisplay(); DebugDisplay();
else else
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
if (bPaintingWindow) if (bPaintingWindow)
EndPaint(GetFrame().g_hFrameWindow,&ps); EndPaint(GetFrame().g_hFrameWindow,&ps);
@ -1322,7 +1322,7 @@ LRESULT CALLBACK FrameWndProc (
} }
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
} }
else if ((wparam == VK_SCROLL) && GetPropertySheet().GetScrollLockToggle()) else if ((wparam == VK_SCROLL) && GetPropertySheet().GetScrollLockToggle())
{ {
@ -2005,7 +2005,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
} }
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
GetFrame().VideoRedrawScreen(); GetVideo().VideoRedrawScreen();
break; break;
case BTN_DRIVE1: case BTN_DRIVE1:

View file

@ -151,7 +151,7 @@ void WinVideo::Benchmark(void)
SetVideoMode(VF_TEXT); SetVideoMode(VF_TEXT);
memset(mem+0x400,0x14,0x400); memset(mem+0x400,0x14,0x400);
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
DWORD milliseconds = GetTickCount(); DWORD milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ; while (GetTickCount() == milliseconds) ;
milliseconds = GetTickCount(); milliseconds = GetTickCount();
@ -173,7 +173,7 @@ void WinVideo::Benchmark(void)
DWORD totalhiresfps = 0; DWORD totalhiresfps = 0;
SetVideoMode(VF_HIRES); SetVideoMode(VF_HIRES);
memset(mem+0x2000,0x14,0x2000); memset(mem+0x2000,0x14,0x2000);
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
milliseconds = GetTickCount(); milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ; while (GetTickCount() == milliseconds) ;
milliseconds = GetTickCount(); milliseconds = GetTickCount();
@ -257,7 +257,7 @@ void WinVideo::Benchmark(void)
// THE SAME TIME // THE SAME TIME
DWORD realisticfps = 0; DWORD realisticfps = 0;
memset(mem+0x2000,0xAA,0x2000); memset(mem+0x2000,0xAA,0x2000);
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
milliseconds = GetTickCount(); milliseconds = GetTickCount();
while (GetTickCount() == milliseconds) ; while (GetTickCount() == milliseconds) ;
milliseconds = GetTickCount(); milliseconds = GetTickCount();
@ -276,7 +276,7 @@ void WinVideo::Benchmark(void)
memset(mem+0x2000,0xAA,0x2000); memset(mem+0x2000,0xAA,0x2000);
else else
memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000); memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
if (cycle++ >= 3) if (cycle++ >= 3)
cycle = 0; cycle = 0;
realisticfps++; realisticfps++;
@ -320,7 +320,7 @@ void WinVideo::ChooseMonochromeColor(void)
VideoReinitialize(); VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG)) if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
{ {
GetFrame().VideoRedrawScreen(); VideoRedrawScreen();
} }
Config_Save_Video(); Config_Save_Video();
} }