aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-04-20 22:31:00 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-04-20 22:31:00 +0200
commit4bee5a27340c23764ebc43d8f8fbf990c8a62b01 (patch)
treefaa2bac62f2cd435cbac6bc7b3734b54cdc6dce2
parentdf16832c0c43015500b4f71aebabbb14e127b447 (diff)
downloadfbida-4bee5a27340c23764ebc43d8f8fbf990c8a62b01.tar.gz
invert partial fix
-rw-r--r--op.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/op.c b/op.c
index 6273541..c208ff7 100644
--- a/op.c
+++ b/op.c
@@ -87,20 +87,24 @@ op_invert(struct ida_image *src, struct ida_rect *rect,
unsigned char *dst, int line, void *data)
{
unsigned char *scanline;
- int i;
+ int i, bpp;
+ bpp = ida_image_bpp(src);
scanline = ida_image_scanline(src, line);
- memcpy(dst,scanline,src->i.width * 3);
+ memcpy(dst, scanline, ida_image_stride(src));
if (line < rect->y1 || line >= rect->y2)
return;
- dst += 3*rect->x1;
- scanline += 3*rect->x1;
+ dst += bpp*rect->x1;
+ scanline += bpp*rect->x1;
for (i = rect->x1; i < rect->x2; i++) {
+
+ /* FIXME for bpp != 3 */
dst[0] = 255-scanline[0];
dst[1] = 255-scanline[1];
dst[2] = 255-scanline[2];
- scanline += 3;
- dst += 3;
+
+ scanline += bpp;
+ dst += bpp;
}
}