flood_fill_seed: initialize left_up and left_down together

Just for readability.
This commit is contained in:
YAMAMOTO Takashi 2021-05-11 14:53:23 +09:00
parent 87ca2b6c2d
commit 22269c9a43

View file

@ -178,21 +178,22 @@ static struct quirc_flood_fill_vars *flood_fill_call_next(
while (*leftp <= vars->right) { while (*leftp <= vars->right) {
if (row[*leftp] == from) { if (row[*leftp] == from) {
struct quirc_flood_fill_vars *next_vars; struct quirc_flood_fill_vars *next_vars;
int next_left;
/* Set up the next context */ /* Set up the next context */
next_vars = vars + 1; next_vars = vars + 1;
next_vars->left_up = *leftp;
next_vars->y = vars->y + direction; next_vars->y = vars->y + direction;
/* Fill the extent */ /* Fill the extent */
flood_fill_line(q, flood_fill_line(q,
next_vars->left_up, *leftp,
next_vars->y, next_vars->y,
from, to, from, to,
func, user_data, func, user_data,
&next_vars->left_up, &next_left,
&next_vars->right); &next_vars->right);
next_vars->left_down = next_vars->left_up; next_vars->left_down = next_left;
next_vars->left_up = next_left;
return next_vars; return next_vars;
} }
@ -215,17 +216,18 @@ static void flood_fill_seed(struct quirc *q,
QUIRC_ASSERT(q->pixels[y0 * q->w + x0] == from); QUIRC_ASSERT(q->pixels[y0 * q->w + x0] == from);
struct quirc_flood_fill_vars *next_vars; struct quirc_flood_fill_vars *next_vars;
int next_left;
/* Set up the first context */ /* Set up the first context */
next_vars = stack; next_vars = stack;
next_vars->left_up = x0;
next_vars->y = y0; next_vars->y = y0;
/* Fill the extent */ /* Fill the extent */
flood_fill_line(q, next_vars->left_up, next_vars->y, from, to, flood_fill_line(q, x0, next_vars->y, from, to,
func, user_data, func, user_data,
&next_vars->left_up, &next_vars->right); &next_left, &next_vars->right);
next_vars->left_down = next_vars->left_up; next_vars->left_down = next_left;
next_vars->left_up = next_left;
while (true) { while (true) {
struct quirc_flood_fill_vars * const vars = next_vars; struct quirc_flood_fill_vars * const vars = next_vars;