- ptrdiff_t src_pitch = CGBitmapContextGetBytesPerRow(src->cgc);
- ptrdiff_t dst_pitch = CGBitmapContextGetBytesPerRow(dst->cgc);
- char *src_data = seek_xy (CGBitmapContextGetData (src->cgc), src_pitch,
- src_x, src_y);
- char *dst_data = seek_xy (CGBitmapContextGetData (dst->cgc), dst_pitch,
- dst_x, dst_y);
-
- size_t bytes = width * 4;
-
- if (src == dst && dst_y > src_y) {
- // Copy upwards if the areas might overlap.
- src_data += src_pitch * (height - 1);
- dst_data += dst_pitch * (height - 1);
- src_pitch = -src_pitch;
- dst_pitch = -dst_pitch;
- }
+ jwxyz_blit (CGBitmapContextGetData (src->cgc),
+ CGBitmapContextGetBytesPerRow (src->cgc), src_x, src_y,
+ CGBitmapContextGetData (dst->cgc),
+ CGBitmapContextGetBytesPerRow (dst->cgc), dst_x, dst_y,
+ width, height);