Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2625)

Unified Diff: dm/DMSrcSink.cpp

Issue 1785613010: Add SkImageGeneratorWIC (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Blacklist bad images Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DM.cpp ('k') | gyp/ports.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « dm/DM.cpp ('k') | gyp/ports.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698