PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

memcpy

if i wish to copy say a 16 bit pixel to another buffer would memcpy be the best and quickest way.?

ie memcpy(buffer,buffertocopyfrom,2);
For a single pixel? No. Using memcpy would be insane :P - you're invoking a function call for a trivial amount of data - lots of overhead for copying 16-bits of data.

You want something more like:
Code:

unsigned short pixel;

...

pixel=*buffertocopyfrom;
*buffer=pixel;
i did not really mean just one pixel ,that was for ease, but if say the i had 240 pixels a one screen line.

would memcpy(buffer,bufftocopyfrom,240*2);

be the best way
Yes.

Proviso:

I'm assuming you're using a GAPI buffer that performs the necessary rotations on devices like the iPAQ 3800. If you're bypassing that, you need to look at the pitch values in GAPI.