ROIFilter: Fix

This commit is contained in:
2023-06-23 14:29:49 +02:00
parent 2b72039045
commit 9089794d46

View File

@@ -25,13 +25,13 @@ public:
if (in_width <= 0) return;
if (x0 >= width) return;
if (x0 + in_width >= width) in_width = width - 1 - x0;
if (x0 + in_width >= width) in_width = width - x0;
if (y0 < 0) { in_height += y0; y0 = 0; }
if (in_height <= 0) return;
if (y0 >= height) return;
if (y0 + in_height >= height) in_height = height - 1 - y0;
if (y0 + in_height >= height) in_height = height - y0;
for (size_t y = y0; y < y0 + in_height; y++) {
for (size_t x = x0; x < x0 + in_width; x++) {
@@ -45,11 +45,14 @@ public:
if (in_width <= 0) return;
if (x0 >= width) return;
if (x0 + in_width >= width) in_width = width - 1 - x0;
if (x0 + in_width >= width) in_width = width - x0;
if (y0 < 0) { in_height += y0; y0 = 0; }
if (in_height <= 0) return;
if (y0 >= height) return;
if (y0 + in_height >= height) in_height = height - y0;
for (size_t y = y0; y < y0 + in_height; y++) {
for (size_t x = x0; x < x0 + in_width; x++) {
mask[y * width + x] &= ~mask_value;