]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change get image height
authorBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 14:13:35 +0000 (15:13 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 14:13:35 +0000 (15:13 +0100)
src/kds_s2000w_handler_opts.c

index dbed0513616eeef4e28ae114070c32eed08d654a..a91905ee41a32bf0dc5f36375c5ffe3233918819 100644 (file)
@@ -134,14 +134,26 @@ int32_t _kds_s2000w_handler_opts_get_image_offset_y(handler_t* h, json_object* v
 
 int32_t _kds_s2000w_handler_opts_get_width(handler_t* h, json_object* value_object, void* value)
 {
-               int32_t* int_value = (int32_t*) value;
-               h->coord->width = json_object_get_int(value_object);
-               value_object = json_object_object_get(h->scanner_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, 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 GOOD;
+       int32_t* int_value = (int32_t*) value;
+       h->coord->width = json_object_get_int(value_object);
+       value_object = json_object_object_get(h->scanner_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, 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 GOOD;
+}
+
+int32_t _kds_s2000w_handler_opts_get_height(handler_t* h, json_object* value_object, void* value)
+{
+       int32_t* int_value = (int32_t*) value;
+       h->coord->height = json_object_get_int(value_object);
+       value_object = json_object_object_get(h->scanner_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, 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 GOOD;
 }
 
 void _kds_s2000w_handler_opts_set_options(handler_t* h)
@@ -532,16 +544,8 @@ int32_t kds_s2000w_handler_opts_get_option(handler_t* h, uint32_t option, void*
        if (strcmp(descriptor->config_name, IMAGE_WIDTH) == 0)
                return _kds_s2000w_handler_opts_get_width(h, value_object, value);
 
-       if (strcmp(descriptor->config_name, IMAGE_HEIGHT) == 0) {
-               int32_t* int_value = (int32_t*) value;
-               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, 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 GOOD;
-       }
+       if (strcmp(descriptor->config_name, IMAGE_HEIGHT) == 0)
+               return _kds_s2000w_handler_opts_get_height(h, value_object, value);
 
        _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value);
        return GOOD;