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

index 006d27f820b18bbbc684b34ce19d7d7b26d6d991..38047c360ab9f58be70f14d429771871d6324171 100644 (file)
@@ -123,6 +123,15 @@ int32_t _kds_s2000w_handler_opts_get_image_offset_x(handler_t* h, json_object* v
                return GOOD;
 }
 
+int32_t _kds_s2000w_handler_opts_get_image_offset_y(handler_t* h, json_object* value_object, void* value)
+{
+               int32_t* int_value = (int32_t*) value;
+               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 GOOD;
+}
+
 void _kds_s2000w_handler_opts_set_options(handler_t* h)
 {
        const char* json_string = json_object_to_json_string_ext(h->scanner_config, JSON_C_TO_STRING_PLAIN);
@@ -505,13 +514,8 @@ int32_t kds_s2000w_handler_opts_get_option(handler_t* h, uint32_t option, void*
        if (strcmp(descriptor->config_name, IMAGE_OFFSET_X) == 0)
                return _kds_s2000w_handler_opts_get_image_offset_x(h, value_object, value);
 
-       if (strcmp(descriptor->config_name, IMAGE_OFFSET_Y) == 0) {
-               int32_t* int_value = (int32_t*) value;
-               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 GOOD;
-       }
+       if (strcmp(descriptor->config_name, IMAGE_OFFSET_Y) == 0)
+               return _kds_s2000w_handler_opts_get_image_offset_y(h, value_object, value);
 
        if (strcmp(descriptor->config_name, IMAGE_WIDTH) == 0) {
                int32_t* int_value = (int32_t*) value;