@@ -4575,9 +4575,9 @@ void Image::renormalize_uint8(uint8_t *p_rgb) {
45754575 n += Vector3 (1 , 1 , 1 );
45764576 n *= 0.5 ;
45774577 n *= 255 ;
4578- p_rgb[0 ] = CLAMP (int (n.x ), 0 , 255 );
4579- p_rgb[1 ] = CLAMP (int (n.y ), 0 , 255 );
4580- p_rgb[2 ] = CLAMP (int (n.z ), 0 , 255 );
4578+ p_rgb[0 ] = CLAMP (int (Math::round ( n.x ) ), 0 , 255 );
4579+ p_rgb[1 ] = CLAMP (int (Math::round ( n.y ) ), 0 , 255 );
4580+ p_rgb[2 ] = CLAMP (int (Math::round ( n.z ) ), 0 , 255 );
45814581}
45824582
45834583void Image::renormalize_float (float *p_rgb) {
@@ -4604,9 +4604,9 @@ void Image::renormalize_uint16(uint16_t *p_rgb) {
46044604 n += Vector3 (1 , 1 , 1 );
46054605 n *= 0.5 ;
46064606 n *= 65535 ;
4607- p_rgb[0 ] = CLAMP (int (n.x ), 0 , 65535 );
4608- p_rgb[1 ] = CLAMP (int (n.y ), 0 , 65535 );
4609- p_rgb[2 ] = CLAMP (int (n.z ), 0 , 65535 );
4607+ p_rgb[0 ] = CLAMP (int (Math::round ( n.x ) ), 0 , 65535 );
4608+ p_rgb[1 ] = CLAMP (int (Math::round ( n.y ) ), 0 , 65535 );
4609+ p_rgb[2 ] = CLAMP (int (Math::round ( n.z ) ), 0 , 65535 );
46104610}
46114611
46124612Image::Image (const uint8_t *p_mem_png_jpg, int p_len) {
0 commit comments