flood_fill_seed: Add assertions

This commit is contained in:
YAMAMOTO Takashi 2021-05-11 13:12:35 +09:00
parent dd6c64cafe
commit 1fa9b0c109

View file

@ -133,11 +133,12 @@ static void flood_fill_line(struct quirc *q, int x, int y,
int right;
int i;
row = q->pixels + y * q->w;
QUIRC_ASSERT(row[x] == from);
left = x;
right = x;
row = q->pixels + y * q->w;
while (left > 0 && row[left - 1] == from)
left--;
@ -163,6 +164,9 @@ static void flood_fill_seed(struct quirc *q,
const struct quirc_flood_fill_vars *const last_vars =
&stack[stack_size - 1];
QUIRC_ASSERT(from != to);
QUIRC_ASSERT(q->pixels[y0 * q->w + x0] == from);
struct quirc_flood_fill_vars *vars;
struct quirc_flood_fill_vars *next_vars;
int i;