Switched to it in a few places.

This commit is contained in:
Relintai 2022-04-18 13:00:14 +02:00
parent d252ecd131
commit 111daab50e
5 changed files with 9 additions and 21 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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() {

View File

@ -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];

View File

@ -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();