summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp')
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp131
1 files changed, 12 insertions, 119 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
index aacfadd2f0..1bd796e58f 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
@@ -11,108 +11,6 @@
namespace rx
{
-NativeWindow::NativeWindow(EGLNativeWindowType window,
- const egl::Config *config,
- bool directComposition)
-{
- mWindow = window;
- mConfig = config;
-}
-
-NativeWindow::~NativeWindow()
-{
-}
-
-void NativeWindow::commitChange()
-{
-}
-
-bool NativeWindow::initialize()
-{
- // If the native window type is a IPropertySet, extract the
- // EGLNativeWindowType (IInspectable) and initialize the
- // proper host with this IPropertySet.
- ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> propertySet;
- ComPtr<IInspectable> eglNativeWindow;
- if (IsEGLConfiguredPropertySet(mWindow, &propertySet, &eglNativeWindow))
- {
- // A property set was found and the EGLNativeWindowType was
- // retrieved. The mWindow member of the host to must be updated
- // to use the EGLNativeWindowType specified in the property set.
- // mWindow is treated as a raw pointer not an AddRef'd interface, so
- // the old mWindow does not need a Release() before this assignment.
- mWindow = eglNativeWindow.Get();
- }
-
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> swapChainPanel;
- if (IsCoreWindow(mWindow, &coreWindow))
- {
- mImpl = std::make_shared<CoreWindowNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(mWindow, propertySet.Get());
- }
- }
- else if (IsSwapChainPanel(mWindow, &swapChainPanel))
- {
- mImpl = std::make_shared<SwapChainPanelNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(mWindow, propertySet.Get());
- }
- }
- else
- {
- ERR("Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include ICoreWindow, ISwapChainPanel and IPropertySet");
- }
-
- return false;
-}
-
-bool NativeWindow::getClientRect(RECT *rect)
-{
- if (mImpl)
- {
- return mImpl->getClientRect(rect);
- }
-
- return false;
-}
-
-#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
-NativeWindow::RotationFlags NativeWindow::rotationFlags() const
-{
- if (mImpl)
- {
- return mImpl->rotationFlags();
- }
-
- return NativeWindow::RotateNone;
-}
-#endif
-
-bool NativeWindow::isIconic()
-{
- return false;
-}
-
-bool NativeWindow::isValidNativeWindow(EGLNativeWindowType window)
-{
- return IsValidEGLNativeWindowType(window);
-}
-
-HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
-{
- if (mImpl)
- {
- bool containsAlpha = (mConfig->alphaSize > 0);
- return mImpl->createSwapChain(device, factory, format, width, height, containsAlpha,
- swapChain);
- }
-
- return E_UNEXPECTED;
-}
bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow)
{
@@ -127,7 +25,7 @@ bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICo
{
if (coreWindow != nullptr)
{
- *coreWindow = coreWin.Detach();
+ *coreWindow = coreWin;
}
return true;
}
@@ -148,7 +46,7 @@ bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml:
{
if (swapChainPanel != nullptr)
{
- *swapChainPanel = panel.Detach();
+ *swapChainPanel = panel;
}
return true;
}
@@ -185,7 +83,8 @@ bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Founda
// considered invalid.
if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
{
- ERR("Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid EGLNativeWindowTypeProperty values include ICoreWindow");
+ ERR() << "Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid "
+ "EGLNativeWindowTypeProperty values include ICoreWindow";
return false;
}
@@ -219,18 +118,6 @@ bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Founda
return false;
}
-// A Valid EGLNativeWindowType IInspectable can only be:
-//
-// ICoreWindow
-// ISwapChainPanel
-// IPropertySet
-//
-// Anything else will be rejected as an invalid IInspectable.
-bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
-{
- return IsCoreWindow(window) || IsSwapChainPanel(window) || IsEGLConfiguredPropertySet(window);
-}
-
// Retrieve an optional property from a property set
HRESULT GetOptionalPropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
const wchar_t *propertyName,
@@ -381,7 +268,13 @@ HRESULT GetOptionalSinglePropertyValue(const ComPtr<ABI::Windows::Foundation::Co
return result;
}
-static float GetLogicalDpi()
+RECT InspectableNativeWindow::clientRect(const Size &size)
+{
+ return {0, 0, static_cast<long>(ConvertDipsToPixels(size.Width)),
+ static_cast<long>(ConvertDipsToPixels(size.Height))};
+}
+
+float GetLogicalDpi()
{
ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
float dpi = 96.0f;
@@ -396,7 +289,7 @@ static float GetLogicalDpi()
return dpi;
}
-long ConvertDipsToPixels(float dips)
+float ConvertDipsToPixels(float dips)
{
static const float dipsPerInch = 96.0f;
return lround((dips * GetLogicalDpi() / dipsPerInch));