|
|
@@ -52,3 +52,24 @@ pipi_image_t *pipi_new(int w, int h) |
|
|
|
return img; |
|
|
|
} |
|
|
|
|
|
|
|
pipi_image_t *pipi_copy(pipi_image_t *src) |
|
|
|
{ |
|
|
|
pipi_image_t *dst = pipi_new(src->w, src->h); |
|
|
|
|
|
|
|
if(src->last_modified != PIPI_PIXELS_UNINITIALISED) |
|
|
|
{ |
|
|
|
pipi_pixels_t *srcp, *dstp; |
|
|
|
|
|
|
|
srcp = &src->p[src->last_modified]; |
|
|
|
dstp = &dst->p[src->last_modified]; |
|
|
|
|
|
|
|
memcpy(dstp, srcp, sizeof(pipi_pixels_t)); |
|
|
|
dstp->pixels = malloc(dstp->bytes); |
|
|
|
memcpy(dstp->pixels, srcp->pixels, dstp->bytes); |
|
|
|
|
|
|
|
dst->last_modified = src->last_modified; |
|
|
|
} |
|
|
|
|
|
|
|
return dst; |
|
|
|
} |
|
|
|
|