ebfee7df17552017410dea79f0d51b2c8e899624 kent Wed Jan 27 10:37:05 2016 -0800 Adding a plausible but as yet untested basic graphic function to copy part of an image to another part. It is surrounded with ifdefs, this mgBlit function, so not actually compiled. diff --git src/lib/memgfx.c src/lib/memgfx.c index aa23c41..9d28f34 100644 --- src/lib/memgfx.c +++ src/lib/memgfx.c @@ -642,34 +642,53 @@ *dx = dest->clipMinX; } if ((over = dest->clipMinY - *dy) > 0) { *h -= over; *sy += over; *dy = dest->clipMinY; } if ((over = *w + *dx - dest->clipMaxX) > 0) *w -= over; if ((over = *h + *dy - dest->clipMaxY) > 0) *h -= over; return (*h > 0 && *w > 0); } +#ifdef SOON /* Simple but as yet untested blit function. */ +void mgBlit(int width, int height, + struct memGfx *source, int sourceX, int sourceY, + struct memGfx *dest, int destX, int destY) +/* Copy pixels in a rectangle from source to destination */ +{ +if (!mgClipForBlit(&width, &height, &sourceX, &sourceY, dest, &destX, &destY)) + return; +while (--height >= 0) + { + Color *dLine = _mgPixAdr(dest,destX,destY++); + Color *sLine = _mgPixAdr(source,sourceX,sourceY++); + memcpy(dLine, sLine, width * sizeof(Color)); + } +} +#endif /* SOON */ + void mgTextBlit(int width, int height, int bitX, int bitY, unsigned char *bitData, int bitDataRowBytes, struct memGfx *dest, int destX, int destY, Color color, Color backgroundColor) +/* Copy pixels from a bit-a-pixel source to a fully colored destination + * within rectangle */ { UBYTE *inLine; Color *outLine; UBYTE inLineBit; if (!mgClipForBlit(&width, &height, &bitX, &bitY, dest, &destX, &destY)) return; inLine = bitData + (bitX>>3) + bitY * bitDataRowBytes; inLineBit = (0x80 >> (bitX&7)); outLine = _mgPixAdr(dest,destX,destY); while (--height >= 0) { UBYTE *in = inLine; Color *out = outLine;