Commit 183f9576 authored by robbycerantola's avatar robbycerantola

image_fast(), more resistent to missbehavior

parent 5d9d35a5
......@@ -36,7 +36,7 @@ fn main() {
t = time::now();
for _i in 0..TIMES {
window.image_fast(40,40,750,550, &data2[..]);
window.image_fast(140,240,750,550, &data2[..]);
}
t2 = time::now();
let dt2 = (t2-t)/TIMES;
......
......@@ -325,12 +325,12 @@ pub trait Renderer {
let start_x = start_x as usize;
let start_y = start_y as usize;
for i in 0..w * h as usize {
for i in 0..(w * h as usize) {
let y0 = i / w;
let y = y0 + start_y;
let x = start_x + i - (y0 * w);
let window_index = y * window_w + x;
if window_index < window_len {
if window_index < window_len && i < image_data.len(){
let new = image_data[i].data;
let alpha = (new >> 24) & 0xFF;
if alpha > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment