Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions Client/cefweb/CWebCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions Client/cefweb/CWebCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 0 additions & 28 deletions Client/cefweb/CWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(SurfaceDesc.Height) <= SIZE_MAX / static_cast<size_t>(LockedRect.Pitch))
[[likely]]
{
const auto memsetSize = static_cast<size_t>(SurfaceDesc.Height) * static_cast<size_t>(LockedRect.Pitch);
std::memset(LockedRect.pBits, 0xFF, memsetSize);
}
pD3DSurface->UnlockRect();
}
}

void CWebView::UpdateTexture()
{
const std::scoped_lock lock(m_RenderData.dataMutex);
Expand Down
1 change: 0 additions & 1 deletion Client/cefweb/CWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class CWebView : public CWebViewInterface,
const bool GetRenderingPaused() const;
void Focus(bool state = true);
IDirect3DTexture9* GetTexture() { return static_cast<IDirect3DTexture9*>(m_pWebBrowserRenderItem->m_pD3DTexture); }
void ClearTexture();

void UpdateTexture();

Expand Down
12 changes: 0 additions & 12 deletions Client/core/DXHook/CDirect3DEvents9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 0 additions & 4 deletions Client/sdk/core/CWebCoreInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading