Hi all, I think I've mentioned this before, but maybe someone can help he derive the fastest way to do the following:
I have 2 buffers, and I like to copy the contents of one to the other (a to b), ignoring a "trans" color (pattern) in a, and only copying the rest overwiping data in the second b, this is one way of doing it:
can it be done faster? (i.e without the if), otherwise thats 76800 if's for one screen copy
without the if, i.e ignoring the trans it's real easy
memcpy(a,b,153600); //16 bit
ideas?
I have 2 buffers, and I like to copy the contents of one to the other (a to b), ignoring a "trans" color (pattern) in a, and only copying the rest overwiping data in the second b, this is one way of doing it:
- Code:
void place_screen_trans(PIXEL *src, PIXEL *dest, int transcolor)
{
int calc;
for (int y = 0; y < 320; y++)
{
for (int x = 0; x < 240; x++)
{
calc = x + (y * x);
if (src[calc] != transcolor)
dest[calc] = src[calc];
}
}
}
can it be done faster? (i.e without the if), otherwise thats 76800 if's for one screen copy
without the if, i.e ignoring the trans it's real easy
memcpy(a,b,153600); //16 bit
ideas?