diff --git a/modules/paint/actions/brighten_action.cpp b/modules/paint/actions/brighten_action.cpp index 9da0c14cc..9a61c9502 100644 --- a/modules/paint/actions/brighten_action.cpp +++ b/modules/paint/actions/brighten_action.cpp @@ -44,7 +44,7 @@ void BrightenAction::do_action(PaintCanvas *canvas, const Array &data) { Color brightened_color = col.lightened(brighten_color); - if (pv2ia_contains(undo_cells, pixel)) { + if (undo_cells.contains(pixel)) { canvas->set_pixel_v(pixel, brightened_color); redo_cells.append(pixel); diff --git a/modules/paint/actions/brush_action.cpp b/modules/paint/actions/brush_action.cpp index 2488df89c..c16f6c558 100644 --- a/modules/paint/actions/brush_action.cpp +++ b/modules/paint/actions/brush_action.cpp @@ -43,7 +43,7 @@ void BrushAction::do_action(PaintCanvas *canvas, const Array &data) { Vector2i off = brush[i]; Vector2i p = pixel + off; - if (pv2ia_contains(undo_cells, p)) { + if (undo_cells.contains(p)) { continue; } diff --git a/modules/paint/actions/bucket_action.cpp b/modules/paint/actions/bucket_action.cpp index 1f2f0a1f1..e9a908232 100644 --- a/modules/paint/actions/bucket_action.cpp +++ b/modules/paint/actions/bucket_action.cpp @@ -30,7 +30,8 @@ SOFTWARE. void BucketAction::do_action(PaintCanvas *canvas, const Array &data) { PaintAction::do_action(canvas, data); - /* +/* + Color col = canvas->get_pixel_v(data[0]); Color col2 = data[2]; @@ -43,8 +44,10 @@ void BucketAction::do_action(PaintCanvas *canvas, const Array &data) { for (int i = 0; i < pixels.size(); ++i) { Vector2i pixel = pixels[i]; - if pixel in action_data.undo.cells: - continue; + if (pv2ia_contains(undo_cells, pixel)) { + continue; + } + if canvas.is_alpha_locked() and canvas.get_pixel_v(pixel) == Color.transparent: continue; @@ -57,7 +60,7 @@ void BucketAction::do_action(PaintCanvas *canvas, const Array &data) { action_data.redo.cells.append(pixel); action_data.redo.colors.append(data[2]); } - */ + */ } BucketAction::BucketAction() { diff --git a/modules/paint/actions/paint_action.cpp b/modules/paint/actions/paint_action.cpp index d227546ba..c038ff87c 100644 --- a/modules/paint/actions/paint_action.cpp +++ b/modules/paint/actions/paint_action.cpp @@ -133,19 +133,6 @@ PoolVector2iArray PaintAction::get_points(PaintCanvas *canvas, const Vector2i &p return PoolVector2iArray(); } -bool PaintAction::pv2ia_contains(const PoolVector2iArray &arr, const Vector2i &v) const { - PoolVector2iArray::Read r = arr.read(); - int s = arr.size(); - - for (int i = 0; i < s; ++s) { - if (r[i] == v) { - return true; - } - } - - return false; -} - void PaintAction::draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr) { for (int i = 0; i < point_arr.size(); ++i) { Vector2i pixel = point_arr[i]; diff --git a/modules/paint/actions/paint_action.h b/modules/paint/actions/paint_action.h index 8ce7c919a..42c5457b9 100644 --- a/modules/paint/actions/paint_action.h +++ b/modules/paint/actions/paint_action.h @@ -54,8 +54,6 @@ public: virtual PoolVector2iArray get_xy_sym_points(const int canvas_width, const int canvas_height, const Vector2i &pixel); virtual PoolVector2iArray get_points(PaintCanvas *canvas, const Vector2i &pixel); - bool pv2ia_contains(const PoolVector2iArray &arr, const Vector2i &v) const; - void draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr); PaintAction();