571 {
572
573 const char* namespaces[1] = {nullptr};
574 const char* uris[1] = {"http://ns.adobe.com/hdr-gain-map/1.0/"};
577 if (!findUriNamespaces(1, uris, namespaces, &
dom, &node)) {
578 return false;
579 }
581
582
586 return false;
587 }
588 if (strcmp(
version,
"1.0") != 0) {
590 return false;
591 }
592
593
594 bool baseRenditionIsHDR = false;
595 SkColor4f gainMapMin = {0.f, 0.f, 0.f, 1.f};
596 SkColor4f gainMapMax = {1.f, 1.f, 1.f, 1.f};
598 SkColor4f offsetSdr = {1.f / 64.f, 1.f / 64.f, 1.f / 64.f, 0.f};
599 SkColor4f offsetHdr = {1.f / 64.f, 1.f / 64.f, 1.f / 64.f, 0.f};
602
603
604 get_attr_bool(
dom, node, hdrgmPrefix,
"BaseRenditionIsHDR", &baseRenditionIsHDR);
612
613
614 if (!outGainmapInfo) {
615 return true;
616 }
618 outGainmapInfo->fGainmapRatioMin = {std::exp(gainMapMin.fR * kLog2),
619 std::exp(gainMapMin.fG * kLog2),
620 std::exp(gainMapMin.fB * kLog2),
621 1.f};
622 outGainmapInfo->fGainmapRatioMax = {std::exp(gainMapMax.fR * kLog2),
623 std::exp(gainMapMax.fG * kLog2),
624 std::exp(gainMapMax.fB * kLog2),
625 1.f};
626 outGainmapInfo->fGainmapGamma = {1.f / gamma.fR, 1.f / gamma.fG, 1.f / gamma.fB, 1.f};
627 outGainmapInfo->fEpsilonSdr = offsetSdr;
628 outGainmapInfo->fEpsilonHdr = offsetHdr;
629 outGainmapInfo->fDisplayRatioSdr = std::exp(hdrCapacityMin * kLog2);
630 outGainmapInfo->fDisplayRatioHdr = std::exp(hdrCapacityMax * kLog2);
631 if (baseRenditionIsHDR) {
633 } else {
635 }
636 return true;
637}
static bool get_attr_bool(const SkDOM *dom, const SkDOM::Node *node, const std::string &prefix, const std::string &key, bool *outValue)
static bool get_attr_float3(const SkDOM *dom, const SkDOM::Node *node, const std::string &prefix, const std::string &key, SkColor4f *outValue)
static bool get_attr_float(const SkDOM *dom, const SkDOM::Node *node, const std::string &prefix, const std::string &key, float *outValue)