From 9677f8354f7970caf004ad74261800bce3bf0e9c Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Sat, 24 Sep 2022 18:06:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=B1=9E?= =?UTF-8?q?=E6=80=A7BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/sane_option_trans.cpp | 4 ++-- twain/twain/huagaods.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sane/sane_option_trans.cpp b/sane/sane_option_trans.cpp index 59887de..d150961 100644 --- a/sane/sane_option_trans.cpp +++ b/sane/sane_option_trans.cpp @@ -223,13 +223,13 @@ namespace sane_opt_trans const char* auto_color_type_from_twain(int val) { - VALUE_FROM_TWAIN(g_auto_color_map, val); + VALUE_FROM_TWAIN(g_color_mode_map, val); return OPTION_VALUE_YSMS_24WCS; } int auto_color_type_to_twain(const char* val) { - VALUE_TO_TWAIN(g_auto_color_map, val); + VALUE_TO_TWAIN(g_color_mode_map, val); return -1; } diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 60b6b9e..c0a76fc 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -1611,6 +1611,8 @@ void huagao_ds::init_support_caps(void) { if(msg == Msg::Set) init = (int)data.currentItem(); + else + data = Capability::createOneValue((Twpp::PaperSize)init); SET_SANE_OPT(now, scanner_, ex_paper, &init); return now == SCANNER_ERR_OK ? success() : badValue(); @@ -1707,6 +1709,7 @@ void huagao_ds::init_support_caps(void) init = (int)data.currentItem(); int ret = SCANNER_ERR_OK; SET_SANE_OPT(ret, scanner_, ex_color_mode, &init); + data = Capability::createOneValue((Twpp::PixelType)init); return ret == SCANNER_ERR_OK ? success() : badValue(); } switch (msg) { @@ -1737,12 +1740,12 @@ void huagao_ds::init_support_caps(void) if (Msg::Set == msg) { auto mech = data.currentItem(); int ret = SCANNER_ERR_OK, val = mech ? COLOR_AUTO_MATCH : COLOR_RGB; - SET_SANE_OPT(ret, scanner_, color_mode, &val); + SET_SANE_OPT(ret, scanner_, ex_auto_color_type, &val); return success(); } int cur = 0; - GET_SANE_OPT(int, scanner_, color_mode, &cur, NULL, NULL, NULL); + GET_SANE_OPT(int, scanner_, ex_auto_color_type, &cur, NULL, NULL, NULL); int twpt = cur == COLOR_AUTO_MATCH ? 1 : 0; return CapSupGetAllReset(msg, data, { FALSE,TRUE }, twpt, false, twpt ? 1 : 0, 0); }; @@ -1794,7 +1797,7 @@ void huagao_ds::init_support_caps(void) // q = (unsigned short)fif.detail; //return CapSupGetAllResetEx(msg, data, q, 80); unsigned short q = m_jpegQuality; - return CapSupGetAllResetEx(msg, data, q, 80); + return CapSupGetAllResetEx(msg, data, q, (UInt16)80); }; m_query[CapType::IOrientation] = msgSupportGetAllSetReset; @@ -1965,7 +1968,9 @@ void huagao_ds::init_support_caps(void) m_autoscan = autoscan; return success(); } - return CapSupGetAllReset(msg, data, m_autoscan, FALSE); + //data = Capability::createOneValue(CapType::AutoScan, m_autoscan); + //return success(); + return CapSupGetAllReset(msg, data, m_autoscan, FALSE); }; m_query[CapType::IAutoSize] = msgSupportGetAllSetReset;