From 025a05d210c231c11ae9d7636a0de7b30bf9adca Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 6 Aug 2024 18:16:59 +0100 Subject: [PATCH] Windows: Remove clearWindowRedirectionBitmap() --- .../juce_Direct2DHwndContext_windows.cpp | 28 ------------------- .../native/juce_Direct2DResources_windows.cpp | 24 ---------------- 2 files changed, 52 deletions(-) diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp index 6158b80e88..1302d5879c 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp @@ -490,8 +490,6 @@ public: if (swapChainThread) swapChainThread->notify(); } - - clearWindowRedirectionBitmap(); } void addDeferredRepaint (Rectangle deferredRepaint) @@ -515,32 +513,6 @@ public: updateRegion.clear(); } - void clearWindowRedirectionBitmap() - { - if (opaque || swap.state != SwapChain::State::bufferAllocated) - return; - - deviceResources.deviceContext.createHwndRenderTarget (hwnd); - - // Clear the GDI redirection bitmap using a Direct2D 1.0 render target - const auto& hwndRenderTarget = deviceResources.deviceContext.hwndRenderTarget; - - if (hwndRenderTarget == nullptr) - return; - - const auto colorF = D2DUtilities::toCOLOR_F (getBackgroundTransparencyKeyColour()); - - RECT clientRect; - GetClientRect (hwnd, &clientRect); - - const D2D1_SIZE_U size { (uint32) (clientRect.right - clientRect.left), - (uint32) (clientRect.bottom - clientRect.top) }; - hwndRenderTarget->Resize (size); - hwndRenderTarget->BeginDraw(); - hwndRenderTarget->Clear (colorF); - hwndRenderTarget->EndDraw(); - } - SavedState* startFrame (float dpiScale) override { if (resizing) diff --git a/modules/juce_graphics/native/juce_Direct2DResources_windows.cpp b/modules/juce_graphics/native/juce_Direct2DResources_windows.cpp index 12af9948a8..0196ec52e9 100644 --- a/modules/juce_graphics/native/juce_Direct2DResources_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DResources_windows.cpp @@ -37,28 +37,6 @@ namespace juce struct Direct2DDeviceContext { - HRESULT createHwndRenderTarget (HWND hwnd) - { - if (hwndRenderTarget != nullptr) - return S_OK; - - SharedResourcePointer directX; - - D2D1_SIZE_U size { 1, 1 }; - - D2D1_RENDER_TARGET_PROPERTIES renderTargetProps{}; - renderTargetProps.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; - renderTargetProps.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; - - D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetProps{}; - hwndRenderTargetProps.hwnd = hwnd; - hwndRenderTargetProps.pixelSize = size; - hwndRenderTargetProps.presentOptions = D2D1_PRESENT_OPTIONS_IMMEDIATELY | D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS; - return directX->getD2DFactory()->CreateHwndRenderTarget (&renderTargetProps, - &hwndRenderTargetProps, - hwndRenderTarget.resetAndGetPointerAddress()); - } - void resetTransform() { context->SetTransform (D2D1::IdentityMatrix()); @@ -71,7 +49,6 @@ struct Direct2DDeviceContext void release() { - hwndRenderTarget = nullptr; context = nullptr; } @@ -95,7 +72,6 @@ struct Direct2DDeviceContext } ComSmartPtr context; - ComSmartPtr hwndRenderTarget; }; class Direct2DBitmap final