| 111 | } |
| 112 | |
| 113 | bool ExtractICCProfile(jpeg_decompress_struct* cinfo, std::vector<uint8_t>& iccProfileData) { |
| 114 | jpeg_saved_marker_ptr marker = cinfo->marker_list; |
| 115 | while (marker) { |
| 116 | if (marker->marker == JPEG_APP0 + 2 && marker->data_length > 14 && |
| 117 | std::memcmp(marker->data, "ICC_PROFILE", 12) == 0) { |
| 118 | iccProfileData.insert(iccProfileData.end(), marker->data + 14, |
| 119 | marker->data + marker->data_length); |
| 120 | } |
| 121 | marker = marker->next; |
| 122 | } |
| 123 | return !iccProfileData.empty(); |
| 124 | } |
| 125 | |
| 126 | bool ParseICCProfile(const std::vector<uint8_t>& iccProfileData, gfx::skcms_ICCProfile* profile) { |
| 127 | return skcms_Parse(iccProfileData.data(), iccProfileData.size(), profile); |
no test coverage detected