Skip to content

Commit da3b241

Browse files
committed
Also fix for bgrx.
1 parent 1355455 commit da3b241

File tree

1 file changed

+3
-3
lines changed
  • plotters-bitmap/src/bitmap_pixel

1 file changed

+3
-3
lines changed

plotters-bitmap/src/bitmap_pixel/bgrx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl PixelFormat for BGRXPixel {
8787
let slice = unsafe { std::slice::from_raw_parts_mut(start_ptr, (count - 1) / 2) };
8888
for rp in slice.iter_mut() {
8989
let ptr = rp as *mut [u8; 8] as *mut u64;
90-
let d1 = unsafe { *ptr };
90+
let d1 = unsafe { ptr.read_unaligned() };
9191
let mut h = (d1 >> 8) & M;
9292
let mut l = d1 & M;
9393

@@ -104,7 +104,7 @@ impl PixelFormat for BGRXPixel {
104104
}
105105

106106
unsafe {
107-
*ptr = h | l;
107+
ptr.write_unaligned(h | l);
108108
}
109109
}
110110

@@ -196,7 +196,7 @@ impl PixelFormat for BGRXPixel {
196196
let d: u64 = std::mem::transmute([
197197
b, g, r, 0, b, g, r, 0, // QW1
198198
]);
199-
*ptr = d;
199+
ptr.write_unaligned(d);
200200
}
201201
}
202202

0 commit comments

Comments
 (0)