From f616e5a1e915e90dd5fccbc303f688aaebbd1eeb Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Fri, 13 Nov 2020 01:54:16 +0000 Subject: [PATCH] Bug 1677004 - More propagating of [u8; 8192]. r=aosmond Differential Revision: https://phabricator.services.mozilla.com/D96954 --- gfx/qcms/src/transform_util.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gfx/qcms/src/transform_util.rs b/gfx/qcms/src/transform_util.rs index e1753812c69d..7dd26b48e972 100644 --- a/gfx/qcms/src/transform_util.rs +++ b/gfx/qcms/src/transform_util.rs @@ -395,22 +395,22 @@ unsafe extern "C" fn compute_precache_pow(mut output: *mut u8, mut gamma: f32) { } #[no_mangle] pub unsafe extern "C" fn compute_precache_lut( - mut output: *mut u8, + mut output: &mut [u8; PRECACHE_OUTPUT_SIZE], mut table: *mut u16, mut length: i32, ) { let mut v: u32 = 0; while v < PRECACHE_OUTPUT_SIZE as u32 { - *output.offset(v as isize) = lut_interp_linear_precache_output(v, table, length); + output[v as usize] = lut_interp_linear_precache_output(v, table, length); v = v + 1 } } #[no_mangle] -pub unsafe extern "C" fn compute_precache_linear(mut output: *mut u8) { +pub unsafe extern "C" fn compute_precache_linear(mut output: &mut [u8; PRECACHE_OUTPUT_SIZE]) { let mut v: u32 = 0; while v < PRECACHE_OUTPUT_SIZE as u32 { //XXX: round? - *output.offset(v as isize) = (v / (PRECACHE_OUTPUT_SIZE / 256) as libc::c_uint) as u8; + output[v as usize] = (v / (PRECACHE_OUTPUT_SIZE / 256) as libc::c_uint) as u8; v = v + 1 } } @@ -439,11 +439,11 @@ pub unsafe extern "C" fn compute_precache( inverted_size = 256 } let mut inverted = invert_lut(&gamma_table_uint, inverted_size); - compute_precache_lut(output.as_mut_ptr(), inverted.as_mut_ptr(), inverted_size); + compute_precache_lut(output, inverted.as_mut_ptr(), inverted_size); } curveType::Curve(data) => { if data.len() == 0 { - compute_precache_linear(output.as_mut_ptr()); + compute_precache_linear(output); } else if data.len() == 1 { compute_precache_pow( output.as_mut_ptr(), @@ -459,11 +459,7 @@ pub unsafe extern "C" fn compute_precache( inverted_size_0 = 256 } //XXX turn this conversion into a function let mut inverted_0 = invert_lut(data, inverted_size_0); - compute_precache_lut( - output.as_mut_ptr(), - inverted_0.as_mut_ptr(), - inverted_size_0, - ); + compute_precache_lut(output, inverted_0.as_mut_ptr(), inverted_size_0); } } }