diff --git a/src/d_main.cpp b/src/d_main.cpp index 80a37b21e..21433acdb 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -937,7 +937,7 @@ void D_Display () I_FreezeTime(false); GSnd->SetSfxPaused(false, 1); } - + screen->End2D(); cycles.Unclock(); FrameCycles = cycles; } diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 08afb72ae..cef60ed7a 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -359,8 +359,9 @@ FNativePalette *OpenGLFrameBuffer::CreatePalette(FRemapTable *remap) // // //========================================================================== -bool OpenGLFrameBuffer::Begin2D(bool) +bool OpenGLFrameBuffer::Begin2D(bool copy3d) { + Super::Begin2D(copy3d); ClearClipRect(); gl_RenderState.mViewMatrix.loadIdentity(); gl_RenderState.mProjectionMatrix.ortho(0, GetWidth(), GetHeight(), 0, -1.0f, 1.0f); diff --git a/src/gl/system/gl_swframebuffer.h b/src/gl/system/gl_swframebuffer.h index 04f961493..c37cf6bf0 100644 --- a/src/gl/system/gl_swframebuffer.h +++ b/src/gl/system/gl_swframebuffer.h @@ -33,7 +33,6 @@ public: OpenGLSWFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra); ~OpenGLSWFrameBuffer(); - bool HasBegun2D() override { return In2D || IsLocked(); } bool IsValid() override; bool Lock(bool buffered) override; void Unlock() override; diff --git a/src/v_video.cpp b/src/v_video.cpp index 3073e259c..f27c0c499 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1122,6 +1122,7 @@ void DFrameBuffer::SetBlendingRect (int x1, int y1, int x2, int y2) bool DFrameBuffer::Begin2D (bool copy3d) { + isIn2D = true; ClearClipRect(); return false; } diff --git a/src/v_video.h b/src/v_video.h index d836e1a1f..1ea7c7bbf 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -413,9 +413,10 @@ public: // avoid copying the software buffer to the screen. // Returns true if hardware-accelerated 2D has been entered, false if not. virtual bool Begin2D(bool copy3d); + void End2D() { isIn2D = false; } // Returns true if Begin2D has been called and 2D drawing is now active - virtual bool HasBegun2D() { return IsLocked(); } + bool HasBegun2D() { return isIn2D; } // DrawTexture calls after Begin2D use native textures. @@ -463,6 +464,7 @@ protected: private: uint32_t LastMS, LastSec, FrameCount, LastCount, LastTic; + bool isIn2D = false; }; diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 332e2416d..85331a347 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -2557,7 +2557,7 @@ bool D3DPal::Update() bool D3DFB::Begin2D(bool copy3d) { - ClearClipRect(); + Super::Begin2D(copy3d); if (!Accel2D) { return false; diff --git a/src/win32/win32swiface.h b/src/win32/win32swiface.h index 7cf8728e0..5c0a456e4 100644 --- a/src/win32/win32swiface.h +++ b/src/win32/win32swiface.h @@ -105,7 +105,6 @@ public: D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen); ~D3DFB (); - bool HasBegun2D() override { return In2D || IsLocked(); } bool IsValid (); bool Lock (bool buffered); void Unlock ();