summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dexela/software-roi.c10
-rw-r--r--plugins/dexela/software-roi.h2
-rw-r--r--plugins/dexela/uca-dexela-camera.c2
3 files changed, 7 insertions, 7 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);
}
}
-
diff --git a/plugins/dexela/software-roi.h b/plugins/dexela/software-roi.h
index e2916f0..3fb3b69 100644
--- a/plugins/dexela/software-roi.h
+++ b/plugins/dexela/software-roi.h
@@ -13,6 +13,6 @@
* @param roiWidth
* @param roiHeight
*/
-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);
#endif // SOFTWAREROI_H
diff --git a/plugins/dexela/uca-dexela-camera.c b/plugins/dexela/uca-dexela-camera.c
index 9269457..5b9c524 100644
--- a/plugins/dexela/uca-dexela-camera.c
+++ b/plugins/dexela/uca-dexela-camera.c
@@ -353,7 +353,7 @@ static gboolean uca_dexela_camera_grab(UcaCamera *camera, gpointer data, GError
g_return_val_if_fail(UCA_IS_DEXELA_CAMERA(camera), FALSE);
UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(camera);
guchar* fullFrame = dexela_grab();
- apply_software_roi(fullFrame, priv->width, data, priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height);
+ apply_software_roi(fullFrame, priv->width, priv->num_bytes, data, priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height);
return TRUE;
}