aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gn/utils.gni1
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp1
-rw-r--r--src/ports/SkRemotableFontMgr_win_dw.cpp2
-rw-r--r--src/ports/SkScalerContext_win_dw.cpp2
-rw-r--r--src/ports/SkTypeface_win_dw.cpp1
-rw-r--r--src/utils/win/SkDWriteNTDDI_VERSION.h31
6 files changed, 38 insertions, 0 deletions
diff --git a/gn/utils.gni b/gn/utils.gni
index 95c4e937c7..7d014b0a0c 100644
--- a/gn/utils.gni
+++ b/gn/utils.gni
@@ -77,6 +77,7 @@ skia_utils_sources = [
"$_src/utils/win/SkDWriteFontFileStream.h",
"$_src/utils/win/SkDWriteGeometrySink.cpp",
"$_src/utils/win/SkDWriteGeometrySink.h",
+ "$_src/utils/win/SkDWriteNTDDI_VERSION.h",
"$_src/utils/win/SkHRESULT.h",
"$_src/utils/win/SkHRESULT.cpp",
"$_src/utils/win/SkIStream.h",
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index c6f15d5ce8..6830d82e03 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkDWriteNTDDI_VERSION.h"
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_WIN)
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp
index 864e488622..6c6613ea37 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkDWriteNTDDI_VERSION.h"
+
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_WIN)
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 10153023d3..8f9a761614 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkDWriteNTDDI_VERSION.h"
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_WIN)
@@ -35,6 +36,7 @@
#include <dwrite.h>
#include <dwrite_1.h>
+#include <dwrite_3.h>
/* Note:
* In versions 8 and 8.1 of Windows, some calls in DWrite are not thread safe.
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index b419ae985f..e6a812fbd7 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkDWriteNTDDI_VERSION.h"
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_WIN)
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