diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-15 16:43:25 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-16 00:01:49 +0800 |
| commit | 246eb9266b9349b44cbe96f3f839124ab30cbb89 (patch) | |
| tree | 31604c8a4764d3a601d56599e56c98d91bd97758 /src/platform/graphics/direct2d/WindowRenderTarget.cpp | |
| parent | b92aa78ac19476049ab881b49c51b1a970a4a973 (diff) | |
| download | cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.tar.gz cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.tar.bz2 cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.zip | |
Impl win subprocess.
Diffstat (limited to 'src/platform/graphics/direct2d/WindowRenderTarget.cpp')
| -rw-r--r-- | src/platform/graphics/direct2d/WindowRenderTarget.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/platform/graphics/direct2d/WindowRenderTarget.cpp b/src/platform/graphics/direct2d/WindowRenderTarget.cpp index 51b6ab22..91d0270b 100644 --- a/src/platform/graphics/direct2d/WindowRenderTarget.cpp +++ b/src/platform/graphics/direct2d/WindowRenderTarget.cpp @@ -29,7 +29,7 @@ D2DWindowRenderTarget::D2DWindowRenderTarget(DirectGraphicsFactory* factory, swap_chain_desc.Flags = 0; // Get the final swap chain for this window from the DXGI factory. - ThrowIfFailed(dxgi_factory->CreateSwapChainForHwnd( + CheckHResult(dxgi_factory->CreateSwapChainForHwnd( d3d11_device, hwnd, &swap_chain_desc, nullptr, nullptr, &dxgi_swap_chain_)); @@ -44,13 +44,13 @@ void D2DWindowRenderTarget::ResizeBuffer(const int width, const int height) { // In order to resize buffer, we need to untarget the buffer first. d2d1_device_context_->SetTarget(nullptr); target_bitmap_ = nullptr; - ThrowIfFailed(dxgi_swap_chain_->ResizeBuffers(0, width, height, + CheckHResult(dxgi_swap_chain_->ResizeBuffers(0, width, height, DXGI_FORMAT_UNKNOWN, 0)); CreateTargetBitmap(); } void D2DWindowRenderTarget::Present() { - ThrowIfFailed(dxgi_swap_chain_->Present(1, 0)); + CheckHResult(dxgi_swap_chain_->Present(1, 0)); } void D2DWindowRenderTarget::CreateTargetBitmap() { @@ -58,7 +58,7 @@ void D2DWindowRenderTarget::CreateTargetBitmap() { // Direct2D needs the dxgi version of the backbuffer surface pointer. Microsoft::WRL::ComPtr<IDXGISurface> dxgi_back_buffer; - ThrowIfFailed( + CheckHResult( dxgi_swap_chain_->GetBuffer(0, IID_PPV_ARGS(&dxgi_back_buffer))); float dpi_x, dpi_y; @@ -71,7 +71,7 @@ void D2DWindowRenderTarget::CreateTargetBitmap() { // Get a D2D surface from the DXGI back buffer to use as the D2D render // target. - ThrowIfFailed(d2d1_device_context_->CreateBitmapFromDxgiSurface( + CheckHResult(d2d1_device_context_->CreateBitmapFromDxgiSurface( dxgi_back_buffer.Get(), &bitmap_properties, &target_bitmap_)); d2d1_device_context_->SetTarget(target_bitmap_.Get()); |
