还原基于文件大小判断twain图像文件传输格式,仍然采用64位或32位判断

This commit is contained in:
yangjiaxuan 2024-07-02 16:05:20 +08:00
parent 1940c573f9
commit a88eaf3b6b
1 changed files with 34 additions and 41 deletions

View File

@ -1155,11 +1155,7 @@ HGResult HGTwainDSImpl::ImageNativeXfer(HGUInt type, HGUInt origin, HGImage* ima
return HGTWAIN_ERR_FAIL;
}
HGResult ret = HGBASE_ERR_FAIL;
int fileSize = info.ImageWidth * info.ImageLength * info.BitsPerPixel / 8;
if (fileSize < 200 * 1024 * 1024)
{
#ifdef _WIN64
HANDLE hMem = NULL;
if (TWRC_XFERDONE != m_dsmImpl->m_pDSMProc(&m_dsmImpl->m_AppId, &m_iden, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hMem))
{
@ -1167,7 +1163,7 @@ HGResult HGTwainDSImpl::ImageNativeXfer(HGUInt type, HGUInt origin, HGImage* ima
}
HGStream stream = NULL;
ret = HGBase_CreateDIBStream(hMem, &stream);
HGResult ret = HGBase_CreateDIBStream(hMem, &stream);
GlobalFree(hMem);
if (HGBASE_ERR_OK != ret)
{
@ -1176,9 +1172,7 @@ HGResult HGTwainDSImpl::ImageNativeXfer(HGUInt type, HGUInt origin, HGImage* ima
ret = HGBase_CreateImageFromStream(stream, NULL, type, origin, image);
HGBase_DestroyStream(stream);
}
else
{
#else
HGChar tmpFile[260];
HGBase_GetTmpFileName("bmp", tmpFile, 260);
@ -1195,10 +1189,9 @@ HGResult HGTwainDSImpl::ImageNativeXfer(HGUInt type, HGUInt origin, HGImage* ima
return HGTWAIN_ERR_FAIL;
}
ret = HGBase_CreateImageFromFile(tmpFile, NULL, type, origin, image);
HGResult ret = HGBase_CreateImageFromFile(tmpFile, NULL, type, origin, image);
HGBase_DeleteFile(tmpFile);
}
#endif
return ret;
}