@ -925,18 +925,22 @@ void wlr_output_send_present(struct wlr_output *output,
void wlr_output_set_gamma ( struct wlr_output * output , size_t size ,
void wlr_output_set_gamma ( struct wlr_output * output , size_t size ,
const uint16_t * r , const uint16_t * g , const uint16_t * b ) {
const uint16_t * r , const uint16_t * g , const uint16_t * b ) {
uint16_t * gamma_lut = NULL ;
if ( size > 0 ) {
gamma_lut = malloc ( 3 * size * sizeof ( uint16_t ) ) ;
if ( gamma_lut = = NULL ) {
wlr_log_errno ( WLR_ERROR , " Allocation failed " ) ;
return ;
}
memcpy ( gamma_lut , r , size * sizeof ( uint16_t ) ) ;
memcpy ( gamma_lut + size , g , size * sizeof ( uint16_t ) ) ;
memcpy ( gamma_lut + 2 * size , b , size * sizeof ( uint16_t ) ) ;
}
output_state_clear_gamma_lut ( & output - > pending ) ;
output_state_clear_gamma_lut ( & output - > pending ) ;
output - > pending . gamma_lut_size = size ;
output - > pending . gamma_lut_size = size ;
output - > pending . gamma_lut = malloc ( 3 * size * sizeof ( uint16_t ) ) ;
output - > pending . gamma_lut = gamma_lut ;
if ( output - > pending . gamma_lut = = NULL ) {
wlr_log_errno ( WLR_ERROR , " Allocation failed " ) ;
return ;
}
memcpy ( output - > pending . gamma_lut , r , size * sizeof ( uint16_t ) ) ;
memcpy ( output - > pending . gamma_lut + size , g , size * sizeof ( uint16_t ) ) ;
memcpy ( output - > pending . gamma_lut + 2 * size , b , size * sizeof ( uint16_t ) ) ;
output - > pending . committed | = WLR_OUTPUT_STATE_GAMMA_LUT ;
output - > pending . committed | = WLR_OUTPUT_STATE_GAMMA_LUT ;
}
}