Warning, /graphics/krita/3rdparty/ext_googleangle/01-patches_qt5.12.12/0001-ANGLE-Use-pixel-sizes-in-the-XAML-swap-chain.patch is written in an unsupported language. File is not indexed.
0001 From 2dc3f1bd5ba301af2de5066ff3d09ccc9b8cbdd2 Mon Sep 17 00:00:00 2001
0002 From: Oliver Wolff <oliver.wolff@qt.io>
0003 Date: Wed, 22 Aug 2018 09:21:04 +0200
0004 Subject: [PATCH 01/17] ANGLE: Use pixel sizes in the XAML swap chain
0005
0006 This is necessary for Qt applications, as they render to GL in physical
0007 pixels. This is consistent with the CoreWindow swap chain behavior.
0008
0009 In order to achieve proper scaling, the scale factor has to be initialized
0010 properly in InspectableNativeWindow.
0011
0012 This change only affects Windows Runtime targets.
0013
0014 Change-Id: I92a365f33752ed49c960e390bbf89cc33ccc8004
0015 ---
0016 .../d3d11/winrt/CoreWindowNativeWindow.cpp | 25 ------------------
0017 .../d3d/d3d11/winrt/CoreWindowNativeWindow.h | 1 -
0018 .../d3d11/winrt/InspectableNativeWindow.cpp | 26 ++++++++++++++++---
0019 .../d3d/d3d11/winrt/InspectableNativeWindow.h | 7 ++++-
0020 4 files changed, 29 insertions(+), 30 deletions(-)
0021
0022 diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
0023 index 7d3f078d6..22e3c65a7 100644
0024 --- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
0025 +++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
0026 @@ -210,29 +210,4 @@ HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWind
0027
0028 return result;
0029 }
0030 -
0031 -static float GetLogicalDpi()
0032 -{
0033 - ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
0034 -
0035 - if (SUCCEEDED(GetActivationFactory(
0036 - HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
0037 - displayProperties.GetAddressOf())))
0038 - {
0039 - float dpi = 96.0f;
0040 - if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
0041 - {
0042 - return dpi;
0043 - }
0044 - }
0045 -
0046 - // Return 96 dpi as a default if display properties cannot be obtained.
0047 - return 96.0f;
0048 -}
0049 -
0050 -float ConvertDipsToPixels(float dips)
0051 -{
0052 - static const float dipsPerInch = 96.0f;
0053 - return dips * GetLogicalDpi() / dipsPerInch;
0054 -}
0055 } // namespace rx
0056 diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
0057 index 044f3d3b6..4e418b985 100644
0058 --- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
0059 +++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
0060 @@ -21,7 +21,6 @@ typedef ABI::Windows::Foundation::
0061
0062 namespace rx
0063 {
0064 -float ConvertDipsToPixels(float dips);
0065
0066 class CoreWindowNativeWindow : public InspectableNativeWindow,
0067 public std::enable_shared_from_this<CoreWindowNativeWindow>
0068 diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
0069 index 0317120b7..e4ef5eca9 100644
0070 --- a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
0071 +++ b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
0072 @@ -290,8 +290,28 @@ HRESULT GetOptionalSinglePropertyValue(
0073
0074 RECT InspectableNativeWindow::clientRect(const Size &size)
0075 {
0076 - // We don't have to check if a swapchain scale was specified here; the default value is 1.0f
0077 - // which will have no effect.
0078 - return {0, 0, lround(size.Width * mSwapChainScale), lround(size.Height * mSwapChainScale)};
0079 + return {0, 0, static_cast<long>(ConvertDipsToPixels(size.Width)),
0080 + static_cast<long>(ConvertDipsToPixels(size.Height))};
0081 +}
0082 +
0083 +float GetLogicalDpi()
0084 +{
0085 + ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
0086 + float dpi = 96.0f;
0087 +
0088 + if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
0089 + {
0090 + if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
0091 + {
0092 + return dpi;
0093 + }
0094 + }
0095 + return dpi;
0096 +}
0097 +
0098 +float ConvertDipsToPixels(float dips)
0099 +{
0100 + static const float dipsPerInch = 96.0f;
0101 + return lround((dips * GetLogicalDpi() / dipsPerInch));
0102 }
0103 } // namespace rx
0104 diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
0105 index 64016b08f..e6e037a86 100644
0106 --- a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
0107 +++ b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
0108 @@ -31,6 +31,9 @@ using namespace ABI::Windows::Foundation::Collections;
0109
0110 namespace rx
0111 {
0112 +float ConvertDipsToPixels(float dips);
0113 +float GetLogicalDpi();
0114 +
0115 class InspectableNativeWindow
0116 {
0117 public:
0118 @@ -38,12 +41,14 @@ class InspectableNativeWindow
0119 : mSupportsSwapChainResize(true),
0120 mSwapChainSizeSpecified(false),
0121 mSwapChainScaleSpecified(false),
0122 - mSwapChainScale(1.0f),
0123 mClientRectChanged(false),
0124 mClientRect({0, 0, 0, 0}),
0125 mNewClientRect({0, 0, 0, 0})
0126 {
0127 mSizeChangedEventToken.value = 0;
0128 + mSwapChainScale = 96.0f / GetLogicalDpi();
0129 + if (mSwapChainScale != 1.0f)
0130 + mSwapChainScaleSpecified = true;
0131 }
0132 virtual ~InspectableNativeWindow() {}
0133
0134 --
0135 2.24.1.windows.2
0136