genesys: Return errors as exceptions from *gamma_buffer()

merge-requests/101/head
Povilas Kanapickas 2019-07-14 23:40:54 +03:00
rodzic e78cfa750f
commit 99b5f1e94e
4 zmienionych plików z 7 dodań i 11 usunięć

Wyświetl plik

@ -2623,7 +2623,6 @@ gl646_send_gamma_table (Genesys_Device * dev, const Genesys_Sensor& sensor)
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
int address; int address;
SANE_Status status = SANE_STATUS_GOOD;
int bits; int bits;
/* gamma table size */ /* gamma table size */
@ -2641,7 +2640,7 @@ gl646_send_gamma_table (Genesys_Device * dev, const Genesys_Sensor& sensor)
/* allocate temporary gamma tables: 16 bits words, 3 channels */ /* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3); std::vector<uint8_t> gamma(size * 2 * 3);
RIE(sanei_genesys_generate_gamma_buffer(dev, sensor, bits, size-1, size, gamma.data())); sanei_genesys_generate_gamma_buffer(dev, sensor, bits, size-1, size, gamma.data());
/* table address */ /* table address */
switch (dev->reg.find_reg(0x05).value >> 6) switch (dev->reg.find_reg(0x05).value >> 6)

Wyświetl plik

@ -3537,7 +3537,7 @@ gl841_send_gamma_table(Genesys_Device * dev, const Genesys_Sensor& sensor)
/* allocate temporary gamma tables: 16 bits words, 3 channels */ /* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3); std::vector<uint8_t> gamma(size * 2 * 3);
RIE(sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data())); sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
/* send address */ /* send address */
status = gl841_set_buffer_address_gamma (dev, 0x00000); status = gl841_set_buffer_address_gamma (dev, 0x00000);

Wyświetl plik

@ -1089,12 +1089,12 @@ std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor&
* @param gamma allocated gamma buffer to fill * @param gamma allocated gamma buffer to fill
* @returns SANE_STATUS_GOOD or SANE_STATUS_NO_MEM * @returns SANE_STATUS_GOOD or SANE_STATUS_NO_MEM
*/ */
SANE_Status sanei_genesys_generate_gamma_buffer(Genesys_Device * dev, void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
const Genesys_Sensor& sensor, const Genesys_Sensor& sensor,
int bits, int bits,
int max, int max,
int size, int size,
uint8_t *gamma) uint8_t* gamma)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED); std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
@ -1146,8 +1146,6 @@ SANE_Status sanei_genesys_generate_gamma_buffer(Genesys_Device * dev,
gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff; gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff;
} }
} }
return SANE_STATUS_GOOD;
} }
@ -1171,7 +1169,7 @@ sanei_genesys_send_gamma_table(Genesys_Device * dev, const Genesys_Sensor& senso
/* allocate temporary gamma tables: 16 bits words, 3 channels */ /* allocate temporary gamma tables: 16 bits words, 3 channels */
std::vector<uint8_t> gamma(size * 2 * 3, 255); std::vector<uint8_t> gamma(size * 2 * 3, 255);
RIE(sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data())); sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
// loop sending gamma tables NOTE: 0x01000000 not 0x10000000 // loop sending gamma tables NOTE: 0x01000000 not 0x10000000
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {

Wyświetl plik

@ -1974,13 +1974,12 @@ sanei_genesys_load_lut (unsigned char * lut,
int slope, int slope,
int offset); int offset);
extern SANE_Status extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
sanei_genesys_generate_gamma_buffer(Genesys_Device * dev,
const Genesys_Sensor& sensor, const Genesys_Sensor& sensor,
int bits, int bits,
int max, int max,
int size, int size,
uint8_t *gamma); uint8_t* gamma);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* ASIC specific functions declarations */ /* ASIC specific functions declarations */