]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change set coordinate by read
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Oct 2025 21:35:02 +0000 (23:35 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Oct 2025 21:35:02 +0000 (23:35 +0200)
src/kds_s2000w_handler_opts.c

index 491c6baa3979b5dfe4166c83fc096f211f1e3489..c6a55c1b03a8f5f998d6e63658a5a3d72afaa6eb 100644 (file)
@@ -386,21 +386,28 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                return;
        }
 
-       if (strcmp(descriptor->config_name, IMAGE_OFFSET_X) == 0
-               || strcmp(descriptor->config_name, IMAGE_OFFSET_Y) == 0) {
+       if (strcmp(descriptor->config_name, IMAGE_OFFSET_X) == 0) {
+               int32_t* int_value = (int32_t*) value;
+               h->coord->offset_x = json_object_get_int(value_object);
+               uint32_t pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, h->coord->offset_x);
+               *int_value = pixel;
+               return;
+       }
+
+       if (strcmp(descriptor->config_name, IMAGE_OFFSET_Y) == 0) {
                int32_t* int_value = (int32_t*) value;
-               int32_t tenth_inch = json_object_get_int(value_object);
-               uint32_t pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, tenth_inch);
+               h->coord->offset_y = json_object_get_int(value_object);
+               uint32_t pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, h->coord->offset_y);
                *int_value = pixel;
                return;
        }
 
        if (strcmp(descriptor->config_name, IMAGE_WIDTH) == 0) {
                int32_t* int_value = (int32_t*) value;
-               int32_t tenth_inch_width = json_object_get_int(value_object);
+               h->coord->width = json_object_get_int(value_object);
                value_object = json_object_object_get(config, IMAGE_OFFSET_X);
                int32_t tenth_inch_offset_x = json_object_get_int(value_object);
-               uint32_t width_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, tenth_inch_width);
+               uint32_t width_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, h->coord->width);
                uint32_t offset_x_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, tenth_inch_offset_x);
                *int_value = offset_x_pixel + width_pixel;
                return;
@@ -408,10 +415,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
 
        if (strcmp(descriptor->config_name, IMAGE_HEIGHT) == 0) {
                int32_t* int_value = (int32_t*) value;
-               int32_t tenth_inch_height = json_object_get_int(value_object);
+               h->coord->height = json_object_get_int(value_object);
                value_object = json_object_object_get(config, IMAGE_OFFSET_Y);
                int32_t tenth_inch_offset_y = json_object_get_int(value_object);
-               uint32_t height_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, tenth_inch_height);
+               uint32_t height_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, h->coord->height);
                uint32_t offset_y_pixel = kds_s2000w_pixel_converter_tenth_inch_to_pixel(GUI_DPI, tenth_inch_offset_y);
                *int_value = offset_y_pixel + height_pixel;
                return;