[plt-scheme] Byte Swapping Bitmap Performance

From: Sam Phillips (samdphillips at gmail.com)
Date: Mon Aug 3 14:28:49 EDT 2009

Hi,

I've pieced together a simple foreign interface to cairo2 that draws to
a canvas.  Cairo's image surfaces have a function
cairo_image_surface_get_data that exposes the raw bytes of the surface,
in the format that the surface is set up for.  Setting up the surface to
use the ARGB32 format I would expect it to be trivial to do a
set-argb-pixels on a bitmap-dc and be done with it.

Except that the bytes from cairo_image_surface_get_data come back as
BGRA, and I have to do a byte swapping operation before setting the
pixels in the bitmap-dc.  Which adds about a second to each screen draw.

Is there a faster way to do this that I'm missing?

Cheers,
Sam


Posted on the users mailing list.