dst_line[x] = 0xff000000
| cliptobyte((c2 + r2) >> 8) << 16 /* red */
| cliptobyte((c2 + g2) >> 8) << 8 /* green */
| cliptobyte((c2 + b2) >> 8); /* blue */
I'm not sure if 0xff is the correct value for the X channel, but technically it shouldn't really matter since the X is ignored. Is there a specific reason why you set it to 0xff?
Otherwise the patch looks ok to me, but I think Henri might want to take a look at it as well before it is committed.