MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / prepare_iter

Method prepare_iter

src/rows.rs:160–177  ·  view source on GitHub ↗
(&mut self, temp_row: &mut [MaybeUninit<RGBA>], allow_steamed: bool)

Source from the content-addressed store, hash-verified

158 }
159
160 pub fn prepare_iter(&mut self, temp_row: &mut [MaybeUninit<RGBA>], allow_steamed: bool) -> Result<(), Error> {
161 debug_assert_eq!(temp_row.len(), self.width as _);
162
163 if self.f_pixels.is_some() || (allow_steamed && self.should_use_low_memory()) {
164 return Ok(());
165 }
166
167 let width = self.width();
168 let lut = gamma_lut(self.gamma);
169 let mut f_pixels = temp_buf(width * self.height())?;
170 for (row, f_row) in f_pixels.chunks_exact_mut(width).enumerate() {
171 let row_pixels = self.row_rgba(temp_row, row);
172 Self::convert_row_to_f(f_row, row_pixels, &lut);
173 }
174 // just initialized
175 self.f_pixels = Some(unsafe { box_assume_init(f_pixels) });
176 Ok(())
177 }
178
179 #[inline]
180 pub fn rows_iter(&mut self, temp_row: &mut [MaybeUninit<RGBA>]) -> Result<DynamicRowsIter<'_, 'pixels, 'rows>, Error> {

Callers 3

rows_iterMethod · 0.80
all_rows_fMethod · 0.80
remap_to_palette_floydFunction · 0.80

Calls 7

gamma_lutFunction · 0.85
temp_bufFunction · 0.85
box_assume_initFunction · 0.85
should_use_low_memoryMethod · 0.80
row_rgbaMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected