Merge pull request #1717 from db48x/remove-unsafe-from-example-code

remove unsafe code from example “issue-1716”
pull/1725/head
José Luis Cruz 3 years ago committed by GitHub
commit 191049a465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,16 +18,10 @@ fn main() {
buffer.push(255);
}
let vframe1 = NcVisual::from_bgra(&buffer, H, W * 4, W).expect("couldnt create visual");
// let voptions = NcVisualOptions::fullsize_pixel_without_plane(0, 0, H, W);
unsafe {
let v = ffi::ncdirectf_render(nc, vframe1, NCBLIT_PIXEL, NCSCALE_NONE, 0, 0);
if !v.is_null() {
ncdirect_raster_frame(nc, v, NCALIGN_LEFT);
}
}
vframe1.destroy();
let vframe1 = NcDirectF::from_bgra(&buffer, H, W * 4, W).expect("couldnt create visual");
let v = vframe1.ncdirectf_render(nc, NCBLIT_PIXEL, NCSCALE_NONE, 0, 0).expect("failed to render image to sixels");
nc.raster_frame(v, NCALIGN_LEFT).expect("failed to print sixels");
vframe1.ncdirectf_free();
nc.stop().expect("failed to destroy ncdirect context");
println!();
}

Loading…
Cancel
Save