From ec54142c33e06acfa5eb08fa54c6fd6f873c132a Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Thu, 15 Feb 2024 16:47:03 +0100 Subject: [PATCH] fix load gamma table --- src/kds_s2000w_handler_opts.c | 12 ++++-------- src/kds_s2000w_option_descriptors.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 89797d8..e11e056 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -214,20 +214,16 @@ void kds_s2000w_handler_get_option(int option, void* value) _write_string_value(value_object, value); break; case 25: - int default_gamma = 0; - memcpy(value, &default_gamma, sizeof(int)); + memcpy(value, &gamma_table[0][0], sizeof(int) * 256); break; case 26: - int default_gamma_r = 0; - memcpy(value, &default_gamma_r, sizeof(int)); + memcpy(value, &gamma_table[0][1], sizeof(int) * 256); break; case 27: - int default_gamma_g = 0; - memcpy(value, &default_gamma_g, sizeof(int)); + memcpy(value, &gamma_table[0][2], sizeof(int) * 256); break; case 28: - int default_gamma_b = 0; - memcpy(value, &default_gamma_b, sizeof(int)); + memcpy(value, &gamma_table[0][3], sizeof(int) * 256); default: break; } diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index d493afc..8c2417e 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -539,11 +539,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 1; + constraint_gamma_range->quant = 0; descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int); + descriptor->size = sizeof(SANE_Int) * 256; } SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r() @@ -563,7 +563,7 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r() descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int); + descriptor->size = sizeof(SANE_Int) * 256; } SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g() @@ -579,11 +579,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 1; + constraint_gamma_range->quant = 0; descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int); + descriptor->size = sizeof(SANE_Int) * 256; } @@ -601,11 +601,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_b() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 1; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; + constraint_gamma_range->quant = 0; + descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int); + descriptor->size = sizeof(SANE_Int) * 256; } void kds_s2000w_option_descriptor_init_option_descriptors() -- 2.39.5