master
 1/**
 2 * This file has no copyright assigned and is placed in the Public Domain.
 3 * This file is part of the mingw-w64 runtime package.
 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 5 */
 6
 7#ifndef _D2D1_2HELPER_H_
 8#define _D2D1_2HELPER_H_
 9
10#if NTDDI_VERSION >= NTDDI_WINBLUE
11
12#ifndef _D2D1_2_H_
13#include <d2d1_2.h>
14#endif
15
16#ifndef D2D_USE_C_DEFINITIONS
17
18#include <winapifamily.h>
19
20#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
21
22namespace D2D1 {
23  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) {
24    D2D1_MATRIX_3X2_F transform = matrix * D2D1::Matrix3x2F::Scale(dpi_x / 96.0f, dpi_y / 96.0f);
25    FLOAT abs_max_zoom_factor = (max_zoom_factor > 0) ? max_zoom_factor : -max_zoom_factor;
26    return D2D1_DEFAULT_FLATTENING_TOLERANCE / (abs_max_zoom_factor * D2D1ComputeMaximumScaleFactor(&transform));
27  }
28}
29
30#endif /* WINAPI_PARTITION_APP */
31
32#endif /* D2D_USE_C_DEFINITIONS */
33
34#endif /* NTDDI_VERSION >= NTDDI_WINBLUE */
35
36#endif /* _D2D1_HELPER_H_ */