Use skcms for ICC parsing in HP codec test
Change-Id: I6319b00ae35a15ffeaf8a785dde874b730f42c13
Reviewed-on: https://skia-review.googlesource.com/129649
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index b31f393..5488ed8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1629,6 +1629,7 @@
":gpu_tool_utils",
":skia",
":tests",
+ ":third_party_skcms",
":tool_utils",
"//third_party/jsoncpp",
"//third_party/libpng",
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 52826ac..6378fab 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -71,6 +71,10 @@
#include "SkXMLWriter.h"
#endif
+#if defined(SK_USE_SKCMS)
+ #include "skcms.h"
+#endif
+
#if SK_SUPPORT_GPU
#include "GrBackendSurface.h"
#include "GrContextPriv.h"
@@ -1084,7 +1088,14 @@
if (kDst_sRGB_Mode == fMode) {
dstSpace = SkColorSpace::MakeSRGB();
} else if (kDst_HPZR30w_Mode == fMode) {
- dstSpace = SkColorSpace::MakeICC(dstData->data(), dstData->size());
+#if defined(SK_USE_SKCMS)
+ skcms_ICCProfile profile;
+ SkAssertResult(skcms_Parse(dstData->data(), dstData->size(), &profile));
+ dstSpace = SkColorSpace::Make(profile);
+ SkASSERT(dstSpace);
+#else
+ return "Cannot use ICC profile without skcms support.";
+#endif
}
SkImageInfo decodeInfo = codec->getInfo().makeColorType(fColorType).makeColorSpace(dstSpace);