aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/win/SkDWriteNTDDI_VERSION.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/win/SkDWriteNTDDI_VERSION.h')
-rw-r--r--src/utils/win/SkDWriteNTDDI_VERSION.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/utils/win/SkDWriteNTDDI_VERSION.h b/src/utils/win/SkDWriteNTDDI_VERSION.h
new file mode 100644
index 0000000000..7196639b97
--- /dev/null
+++ b/src/utils/win/SkDWriteNTDDI_VERSION.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDWriteNTDDI_VERSION_DEFINED
+#define SkDWriteNTDDI_VERSION_DEFINED
+
+// More strictly, this header should be the first thing in a translation unit,
+// since it is effectively negating build flags.
+#if defined(_WINDOWS_) || defined(DWRITE_3_H_INCLUDED)
+#error Must include SkDWriteNTDDI_VERSION.h before any Windows or DWrite headers.
+#endif
+
+// If the build defines NTDDI_VERSION, pretend it didn't.
+// This also requires resetting _WIN32_WINNT and WINVER.
+// dwrite_3.h guards enum, macro, and interface declarations behind NTDDI_VERSION,
+// but it is not clear this is correct since these are all immutable.
+#if defined(NTDDI_VERSION)
+# undef NTDDI_VERSION
+# if defined(_WIN32_WINNT)
+# undef _WIN32_WINNT_WIN10
+# endif
+# if defined(WINVER)
+# undef WINVER
+# endif
+#endif
+
+#endif