Hi Vincent, > +function flip_image_data(img) > +{ > + var w = img.width; > + var h = img.height; > + var temp_w = w; > + var temp_h = h; > + var buff = new Uint8Array(img.width * img.height * 4); > + while (temp_h--) > + { > + while (temp_w--) > + { > + buff[(temp_h * w + temp_w) * 4] = img.data[((h - temp_h - > 1) * w + temp_w) * 4]; > + buff[(temp_h * w + temp_w) * 4 + 1] = img.data[((h - temp_h > - 1) * w + temp_w) * 4 + 1]; > + buff[(temp_h * w + temp_w) * 4 + 2] = img.data[((h - temp_h > - 1) * w + temp_w) * 4 + 2]; > + buff[(temp_h * w + temp_w) * 4 + 3] = img.data[((h - temp_h > - 1) * w + temp_w) * 4 + 3]; > + } > + temp_w = w; > + } > + img.data.set(buff); Couldn't this be done more simply by swapping line by line, rather than pixel by pixel? If I'm not mistaken, the Uint8Array set() method will take an array and offset as a parameter, and you can get a subarray fairly easily. I have no idea if that will provide a performance boost, but it will least enable the Javascript engines to try. Either way, if you could resubmit this as a discrete git-format-patch entry (probably with signed-off-by while you're at it), I'd appreciate it. Cheers, Jeremy _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel