mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	LibGfx: Validate ICC cicpTag some more
This commit is contained in:
		
							parent
							
								
									9f0f3f434f
								
							
						
					
					
						commit
						4eebe753d1
					
				
					 1 changed files with 18 additions and 2 deletions
				
			
		|  | @ -995,8 +995,24 @@ ErrorOr<void> Profile::check_tag_types() | |||
| 
 | ||||
|     // ICC v4, 9.2.17 cicpTag
 | ||||
|     // "Permitted tag types: cicpType"
 | ||||
|     if (!has_type(cicpTag, { CicpTagData::Type }, {})) | ||||
|         return Error::from_string_literal("ICC::Profile: cicpTag has unexpected type"); | ||||
|     if (auto type = m_tag_table.get(cicpTag); type.has_value()) { | ||||
|         if (type.value()->type() != CicpTagData::Type) | ||||
|             return Error::from_string_literal("ICC::Profile: cicpTag has unexpected type"); | ||||
| 
 | ||||
|         // "The colour encoding specified by the CICP tag content shall be equivalent to the data colour space encoding
 | ||||
|         //  represented by this ICC profile.
 | ||||
|         //  NOTE The ICC colour transform cannot match every possible rendering of a CICP colour encoding."
 | ||||
|         // FIXME: Figure out what that means and check for it.
 | ||||
| 
 | ||||
|         // "This tag may be present when the data colour space in the profile header is RGB, YCbCr, or XYZ, and the
 | ||||
|         //  profile class in the profile header is Input or Display. The tag shall not be present for other data colour spaces
 | ||||
|         //  or profile classes indicated in the profile header."
 | ||||
|         bool is_color_space_allowed = data_color_space() == ColorSpace::RGB || data_color_space() == ColorSpace::YCbCr || data_color_space() == ColorSpace::nCIEXYZ; | ||||
|         bool is_profile_class_allowed = device_class() == DeviceClass::InputDevice || device_class() == DeviceClass::DisplayDevice; | ||||
|         bool cicp_is_allowed = is_color_space_allowed && is_profile_class_allowed; | ||||
|         if (!cicp_is_allowed) | ||||
|             return Error::from_string_literal("ICC::Profile: cicpTag present but not allowed"); | ||||
|     } | ||||
| 
 | ||||
|     // ICC v4, 9.2.18 colorantOrderTag
 | ||||
|     // "Permitted tag types: colorantOrderType"
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nico Weber
						Nico Weber