Merge branch 'min_n_colors' into 'master'

fix min color width to 1 (prevent div by 0)

See merge request ngsolve/netgen!608
This commit is contained in:
Hochsteger, Matthias 2023-09-19 16:48:29 +02:00
commit 9593615da7

View File

@ -904,7 +904,7 @@ namespace netgen
data.Append(cf); data.Append(cf);
} }
int n = data.Size()/4; int n = data.Size()/4;
colors.width = min2(n, 1024); colors.width = max2(1,min2(n, 1024));
colors.height = (n+colors.width-1)/colors.width; colors.height = (n+colors.width-1)/colors.width;
for([[maybe_unused]] auto i: Range(n, colors.width*colors.height)) for([[maybe_unused]] auto i: Range(n, colors.width*colors.height))
data.Append({0.0f, 0.0f, 0.0f, 0.0f}); data.Append({0.0f, 0.0f, 0.0f, 0.0f});