Fix warning on gcc.

This commit is contained in:
Relintai 2022-11-15 14:44:50 +01:00
parent 4155ef7ff3
commit 9eaa2bd56f

View File

@ -153,10 +153,10 @@ PoolVector2iArray PaintCanvas::select_same_color(const int p_x, const int p_y) {
PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const int pos_y) { PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const int pos_y) {
PoolVector2iArray pixels; PoolVector2iArray pixels;
PoolIntArray to_check_queue; Vector<int> to_check_queue;
PoolIntArray checked_queue; Vector<int> checked_queue;
to_check_queue.append(PaintUtilities::to_1D(pos_x, pos_y, get_size().x)); to_check_queue.push_back(PaintUtilities::to_1D(pos_x, pos_y, get_size().x));
Color color = get_pixel(pos_x, pos_y); Color color = get_pixel(pos_x, pos_y);
@ -165,44 +165,44 @@ PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const in
to_check_queue.remove(0); to_check_queue.remove(0);
Vector2i p = PaintUtilities::to_2D(idx, get_size().x); Vector2i p = PaintUtilities::to_2D(idx, get_size().x);
if (checked_queue.contains(idx)) { if (checked_queue.find(idx) != -1) {
continue; continue;
} }
checked_queue.append(idx); checked_queue.push_back(idx);
if (get_pixel(p.x, p.y) != color) { if (get_pixel(p.x, p.y) != color) {
continue; continue;
} }
// add to result // add to result
pixels.append(p); pixels.push_back(p);
// check neighbours // check neighbours
int x = p.x - 1; int x = p.x - 1;
int y = p.y; int y = p.y;
if (is_inside_canvas(x, y)) { if (is_inside_canvas(x, y)) {
idx = PaintUtilities::to_1D(x, y, get_size().x); idx = PaintUtilities::to_1D(x, y, get_size().x);
to_check_queue.append(idx); to_check_queue.push_back(idx);
} }
x = p.x + 1; x = p.x + 1;
if (is_inside_canvas(x, y)) { if (is_inside_canvas(x, y)) {
idx = PaintUtilities::to_1D(x, y, get_size().x); idx = PaintUtilities::to_1D(x, y, get_size().x);
to_check_queue.append(idx); to_check_queue.push_back(idx);
} }
x = p.x; x = p.x;
y = p.y - 1; y = p.y - 1;
if (is_inside_canvas(x, y)) { if (is_inside_canvas(x, y)) {
idx = PaintUtilities::to_1D(x, y, get_size().x); idx = PaintUtilities::to_1D(x, y, get_size().x);
to_check_queue.append(idx); to_check_queue.push_back(idx);
} }
y = p.y + 1; y = p.y + 1;
if (is_inside_canvas(x, y)) { if (is_inside_canvas(x, y)) {
idx = PaintUtilities::to_1D(x, y, get_size().x); idx = PaintUtilities::to_1D(x, y, get_size().x);
to_check_queue.append(idx); to_check_queue.push_back(idx);
} }
} }