1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 02:17:06 +00:00

- raster/BMP/GIF/PCX/TIF: fix dealing with very large data (use

`size_t` as appropriate)
- BMP: lessen heap memory usage by only `malloc()`ing a row, not
  whole file
- GIF: lessen heap memory usage by paging (also simplifies some
  function returns); use standard colour char map
- raster: add `raster_malloc()` to fail > 1GB (avoids very large
  output files that most systems can't handle; also lessens to
  some degree chances of being victim of OOM killer on Linux)
- GUI: printing scale dialog: set maxima on X-dim and resolution
  to keep scale <= 200
This commit is contained in:
gitlost
2023-12-22 21:29:54 +00:00
parent 6ff485e6fa
commit 070162214b
27 changed files with 354 additions and 370 deletions

View File

@@ -86,6 +86,7 @@ ScaleWindow::ScaleWindow(BarcodeItem *bc, Zint::QZintXdimDpVars *vars, double or
} else {
spnResolution->setSingleStep(1);
}
set_maxima();
size_msg_ui_set();
@@ -179,6 +180,7 @@ void ScaleWindow::update_scale()
emit scaleChanged(scale);
m_unset = false;
btnScaleUnset->setEnabled(true);
set_maxima();
}
}
@@ -248,6 +250,22 @@ const char *ScaleWindow::getFileType() const
return filetypes[std::max(std::min(cmbFileType->currentIndex(), 2), 0)];
}
void ScaleWindow::set_maxima()
{
float maxXdim = m_bc->bc.getXdimDpFromScale(200.0f, get_dpmm(), getFileType());
if (cmbXdimUnits->currentIndex() == 1) { // Inches
spnXdim->setMaximum(maxXdim / 25.4);
} else {
spnXdim->setMaximum(maxXdim);
}
float maxRes = m_bc->bc.getXdimDpFromScale(200.0f, get_x_dim_mm(), getFileType());
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
spnResolution->setMaximum(maxRes * 25.4);
} else {
spnResolution->setMaximum(maxRes);
}
}
double ScaleWindow::update_vars()
{
double scale = (double) m_bc->bc.getScaleFromXdimDp(get_x_dim_mm(), get_dpmm(), getFileType());