Copies packed format data
(
&mut self,
scanline0: *mut u8,
pitch: i32,
src_pitch: usize,
row_bytes: usize,
)
| 365 | |
| 366 | /// Copies packed format data |
| 367 | unsafe fn copy_packed_data( |
| 368 | &mut self, |
| 369 | scanline0: *mut u8, |
| 370 | pitch: i32, |
| 371 | src_pitch: usize, |
| 372 | row_bytes: usize, |
| 373 | ) -> Result<()> { |
| 374 | let height = self.height as usize; |
| 375 | |
| 376 | if src_pitch == row_bytes { |
| 377 | std::ptr::copy_nonoverlapping( |
| 378 | scanline0, |
| 379 | self.linear_buffer.as_mut_ptr(), |
| 380 | row_bytes * height, |
| 381 | ); |
| 382 | } else { |
| 383 | let src = self.get_src_ptr(scanline0, pitch, src_pitch, height); |
| 384 | |
| 385 | for row in 0..height { |
| 386 | self.copy_row(src, row, src_pitch, row_bytes, 0); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | Ok(()) |
| 391 | } |
| 392 | |
| 393 | /// Gets the source pointer, handling negative pitch (bottom-up images). |
| 394 | #[inline] |
no test coverage detected