修复部分属性BUG

This commit is contained in:
gb 2022-09-24 18:06:05 +08:00
parent 86bcadd095
commit 9677f8354f
2 changed files with 11 additions and 6 deletions

View File

@ -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;
}

View File

@ -1611,6 +1611,8 @@ void huagao_ds::init_support_caps(void)
{
if(msg == Msg::Set)
init = (int)data.currentItem<CapType::ISupportedSizes>();
else
data = Capability::createOneValue<CapType::ISupportedSizes>((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<CapType::IPixelType>();
int ret = SCANNER_ERR_OK;
SET_SANE_OPT(ret, scanner_, ex_color_mode, &init);
data = Capability::createOneValue<CapType::IPixelType>((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<CapType::IAutomaticColorEnabled>();
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<int, Bool, CapType::IAutomaticColorEnabled>(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<unsigned short, UInt16, CapType::IJpegQuality>(msg, data, q, 80);
unsigned short q = m_jpegQuality;
return CapSupGetAllResetEx<unsigned short, UInt16, CapType::IJpegQuality>(msg, data, q, 80);
return CapSupGetAllResetEx<unsigned short, UInt16, CapType::IJpegQuality>(msg, data, q, (UInt16)80);
};
m_query[CapType::IOrientation] = msgSupportGetAllSetReset;
@ -1965,6 +1968,8 @@ void huagao_ds::init_support_caps(void)
m_autoscan = autoscan;
return success();
}
//data = Capability::createOneValue<Bool>(CapType::AutoScan, m_autoscan);
//return success();
return CapSupGetAllReset<Bool, Bool, CapType::AutoScan>(msg, data, m_autoscan, FALSE);
};