291 if (xstart < 0 || ystart < 0 || xdest < 0 || ydest < 0)
294 xext = source->xsize;
295 if (xext > source->xsize - xstart)
297 xext = source->xsize - xstart;
298 if (xext > dest->xsize - xdest)
299 xext = dest->xsize - xdest;
301 yext = source->ysize;
302 if (yext > source->ysize - ystart)
304 yext = source->ysize - ystart;
305 if (yext > dest->ysize - ydest)
306 yext = dest->ysize - ydest;
307 if (xext <= 0 || yext <= 0)
310 srcppb = 8 / source->bpp;
311 if (source->bpp == dest->bpp || !adjust_grey)
314 shift = source->bps - dest->bps;
318 aligned = source->bpp == dest->bpp;
319 if (aligned && srcppb != 0) {
320 aligned = xstart % srcppb == 0
321 && xdest % srcppb == 0
322 && (xext % srcppb == 0 || xdest + xext == dest->xsize);
324 for (y = 0; y < yext; y++) {
328 yoffset = yext - y - 1;
336 memmove (dest->image + (dest->ymax - 1 - ydest - yoffset) * dest->xdim + xdest * 3, source->image + (source->ymax - 1 - ystart - yoffset) * source->xdim + xstart * 3, (
unsigned) bytesize);
339 memmove (dest->image + (dest->ymax - 1 - ydest - yoffset) * dest->xdim + xdest / srcppb, source->image + (source->ymax - 1 - ystart - yoffset) * source->xdim + xstart / srcppb, (
unsigned) bytesize);
346 else if (source->bpp < dest->bpp) {
347 source->
get_line (xstart, ystart + yoffset, xext, ©line, 0);
348 if (source->bpp <= shift
349 && (source->bpp == 1 || source->bpp == 4)) {
350 if (source->bpp == 1) {
351 for (pixel = 0, copy = copyline.
pixels; pixel < xext;
357 for (pixel = 0, copy = copyline.
pixels; pixel < xext;
360 *copy = (*copy << shift) | *copy;
364 for (pixel = 0, copy = copyline.
pixels; pixel < xext;
370 source->
get_line (xstart, ystart + yoffset, xext, ©line, 0);
371 if (source->bpp == 24) {
372 for (pixel = 0, copy = copyline.
pixels + 1; pixel < xext;
379 for (pixel = 0, copy = copyline.
pixels; pixel < xext;
384 dest->
put_line (xdest, ydest + yoffset, xext, ©line, 0);
void check_legal_access(inT32 x, inT32 y, inT32 xext)
void put_line(inT32 x, inT32 y, inT32 width, IMAGELINE *linebuf, inT32 margins)
#define COMPUTE_IMAGE_XDIM(xsize, bpp)
uinT8 * pixels
image pixels
void get_line(inT32 x, inT32 y, inT32 width, IMAGELINE *linebuf, inT32 margins)
void fast_get_line(inT32 x, inT32 y, inT32 width, IMAGELINE *linebuf)