Index: src/utils/win/SkDWrite.cpp |
diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp |
index 16e8ddc4d0d93c4103283616199df0ed5df9aa18..156b36f91376f54fffc107eb483bae682474c2a2 100644 |
--- a/src/utils/win/SkDWrite.cpp |
+++ b/src/utils/win/SkDWrite.cpp |
@@ -13,8 +13,18 @@ |
#include <dwrite.h> |
static IDWriteFactory* gDWriteFactory = NULL; |
+static void (*gDWriteFactoryProc)(IDWriteFactory**) = NULL; |
+ |
+void SkSetDirectWriteFactoryProc(void (*proc)(IDWriteFactory**)) { |
+ gDWriteFactoryProc = proc; |
+} |
static void create_dwrite_factory(IDWriteFactory** factory) { |
+ if (gDWriteFactoryProc) { |
+ gDWriteFactoryProc(factory); |
+ return; |
+ } |
+ |
typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc; |
DWriteCreateFactoryProc dWriteCreateFactoryProc = reinterpret_cast<DWriteCreateFactoryProc>( |
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory")); |