mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Direct2D: Move CompositionTree to Direct2DHwndContext.cpp
This commit is contained in:
parent
1f6c1737eb
commit
8d29edec92
3 changed files with 52 additions and 54 deletions
|
|
@ -598,40 +598,6 @@ std::optional<Direct2DDeviceResources> Direct2DDeviceResources::create (ComSmart
|
|||
return result;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
std::optional<CompositionTree> CompositionTree::create (IDXGIDevice* dxgiDevice,
|
||||
HWND hwnd,
|
||||
IDXGISwapChain1* swapChain)
|
||||
{
|
||||
if (dxgiDevice == nullptr)
|
||||
return {};
|
||||
|
||||
CompositionTree result;
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
|
||||
if (const auto hr = DCompositionCreateDevice (dxgiDevice,
|
||||
__uuidof (IDCompositionDevice),
|
||||
reinterpret_cast<void**> (result.compositionDevice.resetAndGetPointerAddress()));
|
||||
FAILED (hr))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
if (const auto hr = result.compositionDevice->CreateTargetForHwnd (hwnd, FALSE, result.compositionTarget.resetAndGetPointerAddress()); FAILED (hr))
|
||||
return {};
|
||||
if (const auto hr = result.compositionDevice->CreateVisual (result.compositionVisual.resetAndGetPointerAddress()); FAILED (hr))
|
||||
return {};
|
||||
if (const auto hr = result.compositionTarget->SetRoot (result.compositionVisual); FAILED (hr))
|
||||
return {};
|
||||
if (const auto hr = result.compositionVisual->SetContent (swapChain); FAILED (hr))
|
||||
return {};
|
||||
if (const auto hr = result.compositionDevice->Commit(); FAILED (hr))
|
||||
return {};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
String getLocalisedName (IDWriteLocalizedStrings* names)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -409,26 +409,6 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
/* DirectComposition
|
||||
Using DirectComposition enables transparent windows and smoother window
|
||||
resizing
|
||||
|
||||
This class builds a simple DirectComposition tree that ultimately contains
|
||||
the swap chain
|
||||
*/
|
||||
class CompositionTree
|
||||
{
|
||||
public:
|
||||
static std::optional<CompositionTree> create (IDXGIDevice* dxgiDevice, HWND hwnd, IDXGISwapChain1* swapChain);
|
||||
|
||||
private:
|
||||
CompositionTree() = default;
|
||||
|
||||
ComSmartPtr<IDCompositionDevice> compositionDevice;
|
||||
ComSmartPtr<IDCompositionTarget> compositionTarget;
|
||||
ComSmartPtr<IDCompositionVisual> compositionVisual;
|
||||
};
|
||||
|
||||
String getLocalisedName (IDWriteLocalizedStrings* names);
|
||||
String getFontFamilyName (IDWriteFontFamily* family);
|
||||
String getFontFaceName (IDWriteFont* font);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue