aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrow Savcik <krow@savcik.xyz>2024-03-03 22:48:52 +0200
committerKrow Savcik <krow@savcik.xyz>2024-03-03 22:48:52 +0200
commit075354a70a4a93f474fdf083e2cd99826c95ee1a (patch)
tree17c541bb36473119d1563bc28b261cfb30ac8354
parentae4f6cc7e9b567bcecc7fb812aa4ab5058aca379 (diff)
fix actions for layers
-rw-r--r--src/action.h1
-rw-r--r--src/canvas.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/action.h b/src/action.h
index 825057f..67f9077 100644
--- a/src/action.h
+++ b/src/action.h
@@ -12,6 +12,7 @@ struct action_pixcol {
struct ActionPixelsColors {
long int cnt;
+ unsigned lyr;
struct action_pixcol *pix;
};
diff --git a/src/canvas.c b/src/canvas.c
index cfee1a3..927bde1 100644
--- a/src/canvas.c
+++ b/src/canvas.c
@@ -4,6 +4,7 @@
#include <SDL2/SDL_image.h>
#include "types.h"
+#include "ui.h" /* TODO: remove ui.h from canvas */
#include "action.h"
#include "canvas.h"
#include "cdraw.h"
@@ -606,6 +607,7 @@ action_do(Canvas *c)
action_remove(&c->history[c->hist_i]);
c->history[c->hist_i].type = ACT_PIXELSCOLORS;
c->history[c->hist_i].act.px.cnt = c->temp_cnt;
+ c->history[c->hist_i].act.px.lyr = c->cur_layer;
c->history[c->hist_i].act.px.pix = malloc(c->temp_cnt * sizeof(struct action_pixcol));
memcpy(c->history[c->hist_i].act.px.pix, c->temp_pix, c->temp_cnt * sizeof(struct action_pixcol));
if (c->hist_i == c->hist_e)
@@ -668,6 +670,8 @@ action_pixcols_redo(Canvas *c, Action *a)
{
struct action_pixcol *pnt, *end;
unsigned int col;
+ canvas_change_layer(c, a->act.px.lyr);
+ ui_redraw_panel(UI_PANELTYPE_TIMELINE);
pnt = a->act.px.pix;
end = &pnt[a->act.px.cnt];