Monitor: Clip zone polygon to image size when dumping

The polygon vertex coordinated of extra_zone are directly parsed from user input.
Clip the resulting polygon to the image size so we don't try to draw outside of the image.
This is already done for zone polygons stored and loaded from the DB.
This commit is contained in:
Peter Keresztes Schmidt 2021-05-16 15:17:40 +02:00
parent 29488900a1
commit 09665b139f
1 changed files with 4 additions and 0 deletions

View File

@ -1481,6 +1481,10 @@ void Monitor::DumpZoneImage(const char *zone_string) {
zone_image->Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
}
extra_zone = extra_zone.GetClipped(Box({0, 0},
{static_cast<int32>(zone_image->Width()),
static_cast<int32>(zone_image->Height())}));
for (const Zone &zone : zones) {
if (exclude_id && (!extra_colour || !extra_zone.GetVertices().empty()) && zone.Id() == exclude_id) {
continue;