diff --git a/Client/cefweb/CWebCore.cpp b/Client/cefweb/CWebCore.cpp index 7de6daeeabe..c13304843ca 100644 --- a/Client/cefweb/CWebCore.cpp +++ b/Client/cefweb/CWebCore.cpp @@ -776,21 +776,6 @@ bool CWebCore::GetRemoteJavascriptEnabled() return bIsRemoteJavascriptEnabled; } -void CWebCore::OnPreScreenshot() -{ - // Clear all textures - ClearTextures(); -} - -void CWebCore::OnPostScreenshot() -{ - // Re-draw textures - for (auto& pWebView : m_WebViews) - { - pWebView->GetCefBrowser()->GetHost()->Invalidate(CefBrowserHost::PaintElementType::PET_VIEW); - } -} - void CWebCore::OnFPSLimitChange(std::uint16_t fps) { dassert(g_pCore->GetNetwork() != nullptr); // Ensure network module is loaded @@ -835,14 +820,6 @@ void CWebCore::ProcessInputMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) m_pFocusedWebView->InjectKeyboardEvent(keyEvent); } -void CWebCore::ClearTextures() -{ - for (auto& pWebBrowser : m_WebViews) - { - pWebBrowser->ClearTexture(); - } -} - bool CWebCore::SetGlobalAudioVolume(float fVolume) { if (fVolume < 0.0f || fVolume > 1.0f) diff --git a/Client/cefweb/CWebCore.h b/Client/cefweb/CWebCore.h index 9b82d612491..fdc22ade721 100644 --- a/Client/cefweb/CWebCore.h +++ b/Client/cefweb/CWebCore.h @@ -94,14 +94,10 @@ class CWebCore : public CWebCoreInterface CWebViewInterface* GetFocusedWebView(); void SetFocusedWebView(CWebView* pWebView) { m_pFocusedWebView = pWebView; }; void ProcessInputMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); - void ClearTextures(); bool GetRemotePagesEnabled(); bool GetRemoteJavascriptEnabled(); - void OnPreScreenshot(); - void OnPostScreenshot(); - void OnFPSLimitChange(std::uint16_t fps) override; bool SetGlobalAudioVolume(float fVolume); diff --git a/Client/cefweb/CWebView.cpp b/Client/cefweb/CWebView.cpp index 7945e169307..3fee90d770d 100644 --- a/Client/cefweb/CWebView.cpp +++ b/Client/cefweb/CWebView.cpp @@ -325,34 +325,6 @@ void CWebView::Focus(bool state) pWebCore->SetFocusedWebView(nullptr); } -void CWebView::ClearTexture() -{ - if (!m_pWebBrowserRenderItem) [[unlikely]] - return; - - auto* const pD3DSurface = m_pWebBrowserRenderItem->m_pD3DRenderTargetSurface; - if (!pD3DSurface) [[unlikely]] - return; - - D3DSURFACE_DESC SurfaceDesc; - if (FAILED(pD3DSurface->GetDesc(&SurfaceDesc))) [[unlikely]] - return; - - D3DLOCKED_RECT LockedRect; - if (SUCCEEDED(pD3DSurface->LockRect(&LockedRect, nullptr, D3DLOCK_DISCARD))) - { - // Check for integer overflow in size calculation: height * pitch must fit in size_t - // Ensure both are positive and that multiplication won't overflow - if (SurfaceDesc.Height > 0 && LockedRect.Pitch > 0 && static_cast(SurfaceDesc.Height) <= SIZE_MAX / static_cast(LockedRect.Pitch)) - [[likely]] - { - const auto memsetSize = static_cast(SurfaceDesc.Height) * static_cast(LockedRect.Pitch); - std::memset(LockedRect.pBits, 0xFF, memsetSize); - } - pD3DSurface->UnlockRect(); - } -} - void CWebView::UpdateTexture() { const std::scoped_lock lock(m_RenderData.dataMutex); diff --git a/Client/cefweb/CWebView.h b/Client/cefweb/CWebView.h index 05661c1a3ed..36693b2f123 100644 --- a/Client/cefweb/CWebView.h +++ b/Client/cefweb/CWebView.h @@ -80,7 +80,6 @@ class CWebView : public CWebViewInterface, const bool GetRenderingPaused() const; void Focus(bool state = true); IDirect3DTexture9* GetTexture() { return static_cast(m_pWebBrowserRenderItem->m_pD3DTexture); } - void ClearTexture(); void UpdateTexture(); diff --git a/Client/core/DXHook/CDirect3DEvents9.cpp b/Client/core/DXHook/CDirect3DEvents9.cpp index 44996c83aed..f4707fbf427 100644 --- a/Client/core/DXHook/CDirect3DEvents9.cpp +++ b/Client/core/DXHook/CDirect3DEvents9.cpp @@ -648,24 +648,12 @@ void CDirect3DEvents9::OnPresent(IDirect3DDevice9* pDevice, IDirect3DDevice9* pS // Must do this before GUI draw to prevent NVidia performance problems CGraphics::GetSingleton().GetRenderItemManager()->FlushNonAARenderTarget(); - bool bTookScreenShot = false; - if (!CGraphics::GetSingleton().GetScreenGrabber()->IsQueueEmpty()) - { - if (g_pCore->IsWebCoreLoaded()) - g_pCore->GetWebCore()->OnPreScreenshot(); - - bTookScreenShot = true; - } - // Draw pre-GUI primitives CGraphics::GetSingleton().DrawPreGUIQueue(); // Maybe grab screen for upload CGraphics::GetSingleton().GetScreenGrabber()->DoPulse(); - if (bTookScreenShot && g_pCore->IsWebCoreLoaded()) - g_pCore->GetWebCore()->OnPostScreenshot(); - // Draw the GUI CLocalGUI::GetSingleton().Draw(); diff --git a/Client/sdk/core/CWebCoreInterface.h b/Client/sdk/core/CWebCoreInterface.h index 4797c7362d4..9ae556c1103 100644 --- a/Client/sdk/core/CWebCoreInterface.h +++ b/Client/sdk/core/CWebCoreInterface.h @@ -78,14 +78,10 @@ class CWebCoreInterface virtual CWebViewInterface* GetFocusedWebView() = 0; virtual void SetFocusedWebView(CWebView* pWebView) = 0; virtual void ProcessInputMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) = 0; - virtual void ClearTextures() = 0; virtual bool GetRemotePagesEnabled() = 0; virtual bool GetRemoteJavascriptEnabled() = 0; - virtual void OnPreScreenshot() = 0; - virtual void OnPostScreenshot() = 0; - virtual void OnFPSLimitChange(std::uint16_t fps) = 0; virtual bool SetGlobalAudioVolume(float fVolume) = 0;