1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Direct2D: Convert unnecessary multi-threaded factory to single-threaded

This commit is contained in:
reuk 2024-10-09 16:47:08 +01:00
parent fa0ab06d41
commit 362a1cc070
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 3 additions and 11 deletions

View file

@ -336,6 +336,8 @@ public:
Image createSnapshot() const
{
JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
// This won't capture child windows. Perhaps a better approach would be to use
// IGraphicsCaptureItemInterop, although this is only supported on Windows 10 v1903+
@ -357,8 +359,6 @@ public:
if (const auto hr = context->CreateBitmap (size, nullptr, 0, bitmapProperties, snapshot.resetAndGetPointerAddress()); FAILED (hr))
return {};
const ScopedMultithread scope { directX->getD2DMultithread() };
swap.chain->Present (0, DXGI_PRESENT_DO_NOT_WAIT);
// Copy the swap chain buffer to the bitmap snapshot

View file

@ -261,7 +261,6 @@ public:
DirectX() = default;
auto getD2DFactory() const { return d2dSharedFactory; }
auto getD2DMultithread() const { return multithread; }
private:
ComSmartPtr<ID2D1Factory2> d2dSharedFactory = [&]
@ -270,7 +269,7 @@ private:
options.debugLevel = D2D1_DEBUG_LEVEL_NONE;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
ComSmartPtr<ID2D1Factory2> result;
auto hr = D2D1CreateFactory (D2D1_FACTORY_TYPE_MULTI_THREADED,
auto hr = D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED,
__uuidof (ID2D1Factory2),
&options,
(void**) result.resetAndGetPointerAddress());
@ -280,13 +279,6 @@ private:
return result;
}();
ComSmartPtr<ID2D1Multithread> multithread = [&]
{
ComSmartPtr<ID2D1Multithread> result;
d2dSharedFactory->QueryInterface<ID2D1Multithread> (result.resetAndGetPointerAddress());
return result;
}();
public:
DxgiAdapters adapters { d2dSharedFactory };