Fix handling primitive bbox in vecr::renderer

This commit is contained in:
Nikita Lisitsa 2023-06-21 13:06:05 +03:00
parent bc94fe256d
commit 698bd2a60b

View file

@ -60,10 +60,10 @@ namespace psemek::vecr
auto const box = geom::expand(bbox(primitive.mask), aa); auto const box = geom::expand(bbox(primitive.mask), aa);
int xmin = std::max<int>(0, std::floor(box[0].min) * samples_); int xmin = std::floor(std::max(0.f, box[0].min * samples_));
int xmax = std::min<int>(canvas_.width() - 1, std::ceil(box[0].max) * samples_); int xmax = std::floor(std::min(canvas_.width() - 1.f, box[0].max * samples_));
int ymin = std::max<int>(0, std::floor(box[1].min) * samples_); int ymin = std::floor(std::max(0.f, box[1].min * samples_));
int ymax = std::min<int>(canvas_.height() - 1, std::ceil(box[1].max) * samples_); int ymax = std::floor(std::min(canvas_.height() - 1.f, box[1].max * samples_));
for (int y = ymin; y <= ymax; ++y) for (int y = ymin; y <= ymax; ++y)
{ {