Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index e9211e51c2c87f72a11b6776946f539bd476ed62..b770f4a622d629b8c4c407cd52db63608c744108 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -15,6 +15,7 @@ |
#include "SkError.h" |
#include "SkImageGenerator.h" |
#include "SkImageGeneratorCG.h" |
+#include "SkImageGeneratorWIC.h" |
#include "SkMallocPixelRef.h" |
#include "SkMultiPictureDraw.h" |
#include "SkNullCanvas.h" |
@@ -32,6 +33,10 @@ |
#include "SkSwizzler.h" |
#include <functional> |
+#if defined(SK_BUILD_FOR_WIN) |
+ #include "SkAutoCoInitialize.h" |
+#endif |
+ |
#ifdef SK_MOJO |
#include "SkMojo.mojom.h" |
#endif |
@@ -791,6 +796,14 @@ Error ImageGenSrc::draw(SkCanvas* canvas) const { |
return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
} |
+#if defined(SK_BUILD_FOR_WIN) |
+ // Initialize COM in order to test with WIC. |
+ SkAutoCoInitialize com; |
+ if (!com.succeeded()) { |
+ return "Could not initialize COM."; |
+ } |
+#endif |
+ |
SkAutoTDelete<SkImageGenerator> gen(nullptr); |
switch (fMode) { |
case kCodec_Mode: |
@@ -799,14 +812,18 @@ Error ImageGenSrc::draw(SkCanvas* canvas) const { |
return "Could not create codec image generator."; |
} |
break; |
+ case kPlatform_Mode: { |
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
- case kPlatform_Mode: |
gen.reset(SkImageGeneratorCG::NewFromEncodedCG(encoded)); |
+#elif defined(SK_BUILD_FOR_WIN) |
+ gen.reset(SkImageGeneratorWIC::NewFromEncodedWIC(encoded)); |
+#endif |
+ |
if (!gen) { |
- return "Could not create CG image generator."; |
+ return "Could not create platform image generator."; |
} |
break; |
-#endif |
+ } |
default: |
SkASSERT(false); |
return "Invalid image generator mode"; |