Skip to content

Commit

Permalink
fallback to BitBlt when PrintWindow failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed May 4, 2021
1 parent 1b4da5d commit 1f3a19d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Plugins/uWindowCapture/uWindowCapture/WindowTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WindowTexture::WindowTexture(Window* window)
{
windowsGraphicsCapture_ = std::make_shared<WindowsGraphicsCapture>(window_->GetMonitorHandle());
}
else if (window_->IsAltTab())
else// if (window_->IsAltTab())
{
windowsGraphicsCapture_ = std::make_shared<WindowsGraphicsCapture>(window_->GetWindowHandle());
}
Expand Down Expand Up @@ -70,6 +70,10 @@ CaptureMode WindowTexture::GetCaptureModeInternal() const
{
return CaptureMode::BitBlt;
}
else if (isPrintWindowFailed_)
{
return CaptureMode::BitBlt;
}
else
{
return CaptureMode::PrintWindow;
Expand Down Expand Up @@ -303,6 +307,7 @@ bool WindowTexture::CaptureByWin32API()
if (!::PrintWindow(hWnd, hDcMem, PW_RENDERFULLCONTENT))
{
OutputApiError(__FUNCTION__, "PrintWindow");
isPrintWindowFailed_ = true;
return false;
}
break;
Expand Down
1 change: 1 addition & 0 deletions Plugins/uWindowCapture/uWindowCapture/WindowTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class WindowTexture
const Window* const window_;
CaptureMode captureMode_ = CaptureMode::Auto;
std::shared_ptr<WindowsGraphicsCapture> windowsGraphicsCapture_;
bool isPrintWindowFailed_ = false;

std::atomic<ID3D11Texture2D*> unityTexture_ = nullptr;
Microsoft::WRL::ComPtr<ID3D11Texture2D> sharedTexture_;
Expand Down

0 comments on commit 1f3a19d

Please sign in to comment.