kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-fix-pow-ambiguity' into 'master'
genesys: Fix ambiguity of std::pow() on old compilers See merge request sane-project/backends!182merge-requests/183/merge
commit
f3d0a7c17c
|
@ -782,7 +782,7 @@ sanei_genesys_create_gamma_table (std::vector<uint16_t>& gamma_table, int size,
|
|||
maximum, gamma_max, gamma);
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
value = gamma_max * pow ((float) i / size, 1.0 / gamma);
|
||||
value = gamma_max * std::pow(static_cast<double>(i) / size, 1.0 / gamma);
|
||||
if (value > maximum)
|
||||
value = maximum;
|
||||
gamma_table[i] = value;
|
||||
|
|
|
@ -117,8 +117,9 @@ void sanei_genesys_write_pnm_file(const char* filename, uint8_t* data, int depth
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (out, "P%c\n%d\n%d\n%d\n", channels == 1 ? '5' : '6',
|
||||
pixels_per_line, lines, (int) pow (2, depth) - 1);
|
||||
std::fprintf(out, "P%c\n%d\n%d\n%d\n", channels == 1 ? '5' : '6', pixels_per_line, lines,
|
||||
static_cast<int>(std::pow(static_cast<double>(2),
|
||||
static_cast<double>(depth - 1))));
|
||||
}
|
||||
if (channels == 3)
|
||||
{
|
||||
|
@ -169,7 +170,7 @@ void sanei_genesys_write_pnm_file16(const char* filename, uint16_t* data, unsign
|
|||
throw SaneException("could not open %s for writing: %s\n", filename, strerror(errno));
|
||||
}
|
||||
std::fprintf(out, "P%c\n%d\n%d\n%d\n", channels == 1 ? '5' : '6',
|
||||
pixels_per_line, lines, (int) pow (2, 16) - 1);
|
||||
pixels_per_line, lines, 256 * 256 - 1);
|
||||
|
||||
for (unsigned count = 0; count < (pixels_per_line * lines * channels); count++) {
|
||||
fputc(*data >> 8, out);
|
||||
|
|
Ładowanie…
Reference in New Issue