From 718cb1e5d2059b5d88bfe34d8c8bcca6a4550249 Mon Sep 17 00:00:00 2001 From: Mihael Koep Date: Tue, 16 Sep 2014 11:34:47 +0200 Subject: Fix dexela software roi for multi-byte images --- plugins/dexela/software-roi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/dexela/software-roi.c') diff --git a/plugins/dexela/software-roi.c b/plugins/dexela/software-roi.c index 74baa96..6056dec 100644 --- a/plugins/dexela/software-roi.c +++ b/plugins/dexela/software-roi.c @@ -1,12 +1,12 @@ #include "software-roi.h" #include -void apply_software_roi(const guchar* src, guint srcWidth, guchar* dest, guint x, guint y, guint roiWidth, guint roiHeight) +void apply_software_roi(const guchar* src, guint srcWidth, guint bytesPerPixel, guchar* dest, guint x, guint y, guint roiWidth, guint roiHeight) { for (guint row = 0; row < roiHeight; row++) { - guint rowOffset = srcWidth * (y + row); - guint offset = rowOffset + x; - memcpy(dest + row * roiWidth, src + offset, roiWidth); + guint roiWidthInBytes = roiWidth * bytesPerPixel; + guint rowOffset = srcWidth * bytesPerPixel * (y + row); + guint offset = rowOffset + x * bytesPerPixel; + memcpy(dest + row * roiWidthInBytes, src + offset, roiWidthInBytes); } } - -- cgit v1.2.3