mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	render/color: add fallback stub when LCMS2 is disabled
It's cumbersome for compositors to guard every wlr_color_transform_ref() or wlr_color_transform_unref() call behind a #if WLR_HAS_COLOR_MANAGEMENT. Moreover, none of the LCMS2 types are used in our public API. Instead, always install the color.h header, and add a stub for wlr_color_transform_init_linear_to_icc().
This commit is contained in:
		
							parent
							
								
									95ac3e9924
								
							
						
					
					
						commit
						6d07193bda
					
				
					 3 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -20,9 +20,6 @@ endif
 | 
				
			||||||
if not features.get('vulkan-renderer')
 | 
					if not features.get('vulkan-renderer')
 | 
				
			||||||
	exclude_files += 'render/vulkan.h'
 | 
						exclude_files += 'render/vulkan.h'
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
if not features.get('color-management')
 | 
					 | 
				
			||||||
	exclude_files += 'render/color.h'
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
if not features.get('session')
 | 
					if not features.get('session')
 | 
				
			||||||
	exclude_files += 'backend/session.h'
 | 
						exclude_files += 'backend/session.h'
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								render/color_fallback.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								render/color_fallback.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					#include <wlr/render/color.h>
 | 
				
			||||||
 | 
					#include <wlr/util/log.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct wlr_color_transform *wlr_color_transform_init_linear_to_icc(
 | 
				
			||||||
 | 
							const void *data, size_t size) {
 | 
				
			||||||
 | 
						wlr_log(WLR_ERROR, "Cannot create color transform from ICC profile: "
 | 
				
			||||||
 | 
							"LCMS2 is compile-time disabled");
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -46,4 +46,6 @@ if lcms2.found()
 | 
				
			||||||
	wlr_deps += lcms2
 | 
						wlr_deps += lcms2
 | 
				
			||||||
	wlr_files += files('color_lcms2.c')
 | 
						wlr_files += files('color_lcms2.c')
 | 
				
			||||||
	features += { 'color-management': true }
 | 
						features += { 'color-management': true }
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						wlr_files += files('color_fallback.c')
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue