kopia lustrzana https://gitlab.com/sane-project/backends
Store size of shading table in ASIC structure.
rodzic
ed1997b22f
commit
60a244ed1e
|
@ -2323,10 +2323,7 @@ Asic_SetWindow (ASIC * chip, SCANSOURCE lsLightSource,
|
|||
((RealTableSize + (TABLE_BASE_SIZE - 1)) &
|
||||
~(TABLE_BASE_SIZE - 1));
|
||||
|
||||
/* TODO: table size should be stored in ASIC structure */
|
||||
RealTableSize = sizeof (unsigned short) *
|
||||
ShadingTableSize ((int) ((wWidth + 4) * XRatioAdderDouble));
|
||||
status = SetShadingTable (chip, dwTableBaseAddr, RealTableSize,
|
||||
status = SetShadingTable (chip, dwTableBaseAddr, chip->dwShadingTableSize,
|
||||
chip->pShadingTable);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
@ -2657,7 +2654,6 @@ Asic_SetShadingTable (ASIC * chip, unsigned short * pWhiteShading,
|
|||
unsigned short i, j, n;
|
||||
unsigned short wValidPixelNumber;
|
||||
double dbXRatioAdderDouble;
|
||||
unsigned int wShadingTableSize;
|
||||
DBG_ASIC_ENTER ();
|
||||
|
||||
if (chip->firmwarestate != FS_OPENED)
|
||||
|
@ -2674,15 +2670,14 @@ Asic_SetShadingTable (ASIC * chip, unsigned short * pWhiteShading,
|
|||
wValidPixelNumber = (unsigned short) ((wWidth + 4) * dbXRatioAdderDouble);
|
||||
DBG (DBG_ASIC, "wValidPixelNumber=%d\n", wValidPixelNumber);
|
||||
|
||||
/* Clear old shading table, if present.
|
||||
/* Free old shading table, if present.
|
||||
First 4 and last 5 elements of shading table cannot be used. */
|
||||
wShadingTableSize = ShadingTableSize (wValidPixelNumber) *
|
||||
chip->dwShadingTableSize = ShadingTableSize (wValidPixelNumber) *
|
||||
sizeof (unsigned short);
|
||||
free (chip->pShadingTable);
|
||||
|
||||
DBG (DBG_ASIC, "allocating a new shading table, size=%d byte\n",
|
||||
wShadingTableSize);
|
||||
chip->pShadingTable = malloc (wShadingTableSize);
|
||||
chip->dwShadingTableSize);
|
||||
chip->pShadingTable = malloc (chip->dwShadingTableSize);
|
||||
if (!chip->pShadingTable)
|
||||
{
|
||||
DBG (DBG_ASIC, "pShadingTable == NULL\n");
|
||||
|
|
|
@ -203,6 +203,8 @@ typedef struct
|
|||
ADConverter AD;
|
||||
|
||||
SANE_Byte isMotorMoveToFirstLine;
|
||||
|
||||
unsigned int dwShadingTableSize;
|
||||
unsigned short * pShadingTable;
|
||||
|
||||
SANE_Byte RegisterBankStatus;
|
||||
|
|
Ładowanie…
Reference in New Issue