mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- moved locking logic from DCanvas to DFrameBuffer.
The software canvases used for rendering camera textures and save pictures in the software renderer do not need this.
This commit is contained in:
parent
dd491d6558
commit
ba799aebbd
11 changed files with 6 additions and 65 deletions
|
@ -516,31 +516,6 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
|
|||
setmsgcolor (PRINTLEVELS+1, self);
|
||||
}
|
||||
|
||||
static void maybedrawnow (bool tick, bool force)
|
||||
{
|
||||
// FIXME: Does not work right with hw2d
|
||||
if (ConsoleDrawing || screen == NULL || screen->IsLocked () || screen->Accel2D || ConFont == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (vidactive &&
|
||||
(((tick || gameaction != ga_nothing) && ConsoleState == c_down)
|
||||
|| gamestate == GS_STARTUP))
|
||||
{
|
||||
static size_t lastprinttime = 0;
|
||||
size_t nowtime = I_GetTime();
|
||||
|
||||
if (nowtime - lastprinttime > 1 || force)
|
||||
{
|
||||
screen->Lock (false);
|
||||
C_DrawConsole (false);
|
||||
screen->Update ();
|
||||
lastprinttime = nowtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct TextQueue
|
||||
{
|
||||
TextQueue (bool notify, int printlevel, const char *text)
|
||||
|
@ -857,7 +832,6 @@ int PrintString (int printlevel, const char *outline)
|
|||
if (vidactive && screen && SmallFont)
|
||||
{
|
||||
NotifyStrings.AddString(printlevel, outline);
|
||||
maybedrawnow (false, false);
|
||||
}
|
||||
}
|
||||
else if (Logfile != NULL)
|
||||
|
@ -1088,13 +1062,11 @@ void C_InitTicker (const char *label, unsigned int max, bool showpercent)
|
|||
TickerMax = max;
|
||||
TickerLabel = label;
|
||||
TickerAt = 0;
|
||||
maybedrawnow (true, false);
|
||||
}
|
||||
|
||||
void C_SetTicker (unsigned int at, bool forceUpdate)
|
||||
{
|
||||
TickerAt = at > TickerMax ? TickerMax : at;
|
||||
maybedrawnow (true, TickerVisible ? forceUpdate : false);
|
||||
}
|
||||
|
||||
void C_DrawConsole (bool hw2d)
|
||||
|
|
|
@ -93,13 +93,9 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
viewwindowy = y;
|
||||
viewactive = true;
|
||||
|
||||
canvas->Lock(true);
|
||||
|
||||
RenderActorView(actor, dontmaplines);
|
||||
Threads.MainThread()->FlushDrawQueue();
|
||||
DrawerThreads::WaitForWorkers();
|
||||
|
||||
canvas->Unlock();
|
||||
|
||||
RenderTarget = screen;
|
||||
R_ExecuteSetViewSize(Viewpoint, Viewwindow);
|
||||
|
|
|
@ -1171,12 +1171,6 @@ void SDLGLFB::Unlock()
|
|||
}
|
||||
}
|
||||
|
||||
bool SDLGLFB::IsLocked()
|
||||
{
|
||||
return m_Lock > 0;
|
||||
}
|
||||
|
||||
|
||||
bool SDLGLFB::IsFullscreen()
|
||||
{
|
||||
return CocoaVideo::IsFullscreen();
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
|
||||
virtual bool Lock(bool buffered = true);
|
||||
virtual void Unlock();
|
||||
virtual bool IsLocked();
|
||||
|
||||
virtual bool IsFullscreen();
|
||||
virtual void SetVSync(bool vsync);
|
||||
|
|
|
@ -524,11 +524,6 @@ void SDLGLFB::Unlock ()
|
|||
}
|
||||
}
|
||||
|
||||
bool SDLGLFB::IsLocked ()
|
||||
{
|
||||
return m_Lock>0;// true;
|
||||
}
|
||||
|
||||
bool SDLGLFB::IsFullscreen ()
|
||||
{
|
||||
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
bool Lock(bool buffered);
|
||||
bool Lock ();
|
||||
void Unlock();
|
||||
bool IsLocked ();
|
||||
|
||||
bool IsValid ();
|
||||
bool IsFullscreen ();
|
||||
|
|
|
@ -208,7 +208,6 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
|||
PalEntry palette[256];
|
||||
|
||||
// Take a snapshot of the player's view
|
||||
pic->Lock ();
|
||||
if (r_polyrenderer)
|
||||
{
|
||||
PolyRenderer::Instance()->Viewpoint = r_viewpoint;
|
||||
|
@ -227,7 +226,6 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
|||
}
|
||||
screen->GetFlashedPalette (palette);
|
||||
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch(), Gamma);
|
||||
pic->Unlock ();
|
||||
delete pic;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,11 +95,7 @@ FRenderer *Renderer;
|
|||
EXTERN_CVAR (Bool, swtruecolor)
|
||||
EXTERN_CVAR (Bool, fullscreen)
|
||||
|
||||
#if defined(_DEBUG) && defined(_M_IX86) && !defined(__MINGW32__)
|
||||
#define DBGBREAK { __asm int 3 }
|
||||
#else
|
||||
#define DBGBREAK
|
||||
#endif
|
||||
#define DBGBREAK assert(0)
|
||||
|
||||
class DDummyFrameBuffer : public DFrameBuffer
|
||||
{
|
||||
|
@ -111,7 +107,9 @@ public:
|
|||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
// These methods should never be called.
|
||||
bool Lock(bool buffered) { DBGBREAK; return false; }
|
||||
void Unlock() { DBGBREAK; }
|
||||
void Update() { DBGBREAK; }
|
||||
PalEntry *GetPalette() { DBGBREAK; return NULL; }
|
||||
void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; }
|
||||
|
|
|
@ -214,11 +214,6 @@ public:
|
|||
|
||||
virtual bool IsValid ();
|
||||
|
||||
// Access control
|
||||
virtual bool Lock (bool buffered=true) = 0; // Returns true if the surface was lost since last time
|
||||
virtual void Unlock () = 0;
|
||||
virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
|
||||
|
||||
protected:
|
||||
uint8_t *Buffer;
|
||||
int Width;
|
||||
|
@ -298,8 +293,9 @@ protected:
|
|||
public:
|
||||
DFrameBuffer (int width, int height, bool bgra);
|
||||
|
||||
// Force the surface to use buffered output if true is passed.
|
||||
virtual bool Lock (bool buffered) = 0;
|
||||
// Access control
|
||||
virtual bool Lock(bool buffered = true) = 0; // Returns true if the surface was lost since last time
|
||||
virtual void Unlock() = 0;
|
||||
|
||||
// Make the surface visible. Also implies Unlock().
|
||||
virtual void Update () = 0;
|
||||
|
|
|
@ -1183,11 +1183,6 @@ void Win32GLFrameBuffer::Unlock ()
|
|||
m_Lock--;
|
||||
}
|
||||
|
||||
bool Win32GLFrameBuffer::IsLocked ()
|
||||
{
|
||||
return m_Lock > 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
bool Lock(bool buffered);
|
||||
bool Lock ();
|
||||
void Unlock();
|
||||
bool IsLocked ();
|
||||
|
||||
|
||||
bool IsFullscreen();
|
||||
|
|
Loading…
Reference in a new issue