summaryrefslogtreecommitdiffstats
path: root/plugins/dexela/software-roi.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2014-09-17 09:59:46 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2014-09-17 09:59:46 +0200
commit3ba1fbe128fc4a5b290dba6f1e2560490157f65f (patch)
tree4535c7851d6c84d8b713f3ba618fde7a7d754eb2 /plugins/dexela/software-roi.c
parent05523b118bf396f33528b7aa59db5ad1b7378d54 (diff)
parentd35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9 (diff)
downloaduca-3ba1fbe128fc4a5b290dba6f1e2560490157f65f.tar.gz
uca-3ba1fbe128fc4a5b290dba6f1e2560490157f65f.tar.bz2
uca-3ba1fbe128fc4a5b290dba6f1e2560490157f65f.tar.xz
uca-3ba1fbe128fc4a5b290dba6f1e2560490157f65f.zip
Merge pull request #57 from miq/plugin-dexela-roi
Dexela plugin updates
Diffstat (limited to 'plugins/dexela/software-roi.c')
-rw-r--r--plugins/dexela/software-roi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/dexela/software-roi.c b/plugins/dexela/software-roi.c
new file mode 100644
index 0000000..6056dec
--- /dev/null
+++ b/plugins/dexela/software-roi.c
@@ -0,0 +1,12 @@
+#include "software-roi.h"
+#include <string.h>
+
+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 roiWidthInBytes = roiWidth * bytesPerPixel;
+ guint rowOffset = srcWidth * bytesPerPixel * (y + row);
+ guint offset = rowOffset + x * bytesPerPixel;
+ memcpy(dest + row * roiWidthInBytes, src + offset, roiWidthInBytes);
+ }
+}