All pastes #486008 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-13 18:21 UTC
rendered paste body
int applyInputFrame(u_int8_t *raw_frame, InputFrame *data, u_int32_t frame_height, u_int32_t frame_width)
{
	// TODO: Error-checking
	unsigned long i, j;
	
	for (i = 0; i < data->num_rects; i++)
	{
		InputRect *rect = &data->rects[i];
		
		for (j = 0; j < rect->height; j++)
		{
			u_int8_t *raw_frame_line = raw_frame + 4 * frame_width * (rect->y + j); // go to the rect->y + j line.
			memcpy(raw_frame_line + 4 * rect->x, rect->data, sizeof(u_int8_t) * rect->width * 4);
		}
	}
 
}