summaryrefslogtreecommitdiffstats
path: root/plugins/dexela/software-roi.c
diff options
context:
space:
mode:
authorMihael Koep <koep@schneide.com>2014-09-16 11:34:47 +0200
committerMihael Koep <koep@schneide.com>2014-09-17 09:45:13 +0200
commit718cb1e5d2059b5d88bfe34d8c8bcca6a4550249 (patch)
tree98ea988923811fbc431c55017ec48d3deb286bf1 /plugins/dexela/software-roi.c
parentf39be2686446c41a5fbf93eba7fb40ca99efcc3a (diff)
downloadlibuca-718cb1e5d2059b5d88bfe34d8c8bcca6a4550249.tar.gz
libuca-718cb1e5d2059b5d88bfe34d8c8bcca6a4550249.tar.bz2
libuca-718cb1e5d2059b5d88bfe34d8c8bcca6a4550249.tar.xz
libuca-718cb1e5d2059b5d88bfe34d8c8bcca6a4550249.zip
Fix dexela software roi for multi-byte images
Diffstat (limited to 'plugins/dexela/software-roi.c')
-rw-r--r--plugins/dexela/software-roi.c10
1 files changed, 5 insertions, 5 deletions
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 <string.h>
-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);
}
}
-