fix solid_blit pointer stuff

i did not read the doc comments for pointer methods and mistakenly
thought i needed to calculate raw byte offsets here, but actually it
works in units of size T (where T in our case is either u8 or u32)
This commit is contained in:
Gered 2023-03-11 21:14:01 -05:00
parent 2cf763bb73
commit 99de921f64

View file

@ -275,9 +275,9 @@ pub unsafe fn per_pixel_rotozoom_blit<PixelType: Pixel>(
impl<PixelType: Pixel> Bitmap<PixelType> {
pub unsafe fn solid_blit(&mut self, src: &Self, src_region: &Rect, dest_x: i32, dest_y: i32) {
let src_row_length = src_region.width as usize * Self::PIXEL_SIZE;
let src_pitch = src.width as usize * Self::PIXEL_SIZE;
let dest_pitch = self.width as usize * Self::PIXEL_SIZE;
let src_row_length = src_region.width as usize;
let src_pitch = src.width as usize;
let dest_pitch = self.width as usize;
let mut src_pixels = src.pixels_at_ptr_unchecked(src_region.x, src_region.y);
let mut dest_pixels = self.pixels_at_mut_ptr_unchecked(dest_x, dest_y);