From 75f974ed5e61c24f5432992a70b2510eeaa71152 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Wed, 13 Sep 2023 07:31:26 +0000
Subject: [PATCH 4/4] headers: Add d2d1_2helper.h

Signed-off-by: Biswapriyo Nath <[email protected]>
---
 mingw-w64-headers/include/d2d1_2helper.h | 36 ++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 mingw-w64-headers/include/d2d1_2helper.h

diff --git a/mingw-w64-headers/include/d2d1_2helper.h 
b/mingw-w64-headers/include/d2d1_2helper.h
new file mode 100644
index 0000000..6b55a48
--- /dev/null
+++ b/mingw-w64-headers/include/d2d1_2helper.h
@@ -0,0 +1,36 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#ifndef _D2D1_2HELPER_H_
+#define _D2D1_2HELPER_H_
+
+#if NTDDI_VERSION >= NTDDI_WINBLUE
+
+#ifndef _D2D1_2_H_
+#include <d2d1_2.h>
+#endif
+
+#ifndef D2D_USE_C_DEFINITIONS
+
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+
+namespace D2D1 {
+  COM_DECLSPEC_NOTHROW D2D1FORCEINLINE FLOAT ComputeFlatteningTolerance(const 
D2D1_MATRIX_3X2_F &matrix, FLOAT dpi_x = 96.0f, FLOAT dpi_y = 96.0f, FLOAT 
max_zoom_factor = 1.0f) {
+    D2D1_MATRIX_3X2_F transform = matrix * D2D1::Matrix3x2F::Scale(dpi_x / 
96.0f, dpi_y / 96.0f);
+    FLOAT abs_max_zoom_factor = (max_zoom_factor > 0) ? max_zoom_factor : 
-max_zoom_factor;
+    return D2D1_DEFAULT_FLATTENING_TOLERANCE / (abs_max_zoom_factor * 
D2D1ComputeMaximumScaleFactor(&transform));
+  }
+}
+
+#endif /* WINAPI_PARTITION_APP */
+
+#endif /* D2D_USE_C_DEFINITIONS */
+
+#endif /* NTDDI_VERSION >= NTDDI_WINBLUE */
+
+#endif /* _D2D1_HELPER_H_ */
-- 
2.42.0

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to