add history to layer create, delete, move, rename, and merge

This commit is contained in:
2019-06-18 17:39:35 +02:00
parent c48a6da8a6
commit 9ee4bc42b9
12 changed files with 259 additions and 137 deletions

View File

@@ -9,10 +9,12 @@ class LayerFrame
class Layer
{
static uint32_t s_count;
public:
Layer() = default;
Layer() { id = s_count++; }
Layer(const Layer&) = delete;
~Layer() { LOG("LAYER AUTO DESTROY"); destroy(); }
uint32_t id;
RTT m_rtt[6];
glm::vec4 m_dirty_box[6] = SIXPLETTE(glm::vec4(0));
bool m_dirty_face[6] = SIXPLETTE(false);
@@ -26,7 +28,7 @@ public:
int h = 0;
struct Snapshot
{
std::unique_ptr<uint8_t[]> image[6] = SIXPLETTE(0);
std::shared_ptr<uint8_t[]> image[6] = SIXPLETTE(0);
glm::vec4 m_dirty_box[6] = SIXPLETTE(glm::vec4(0));
bool m_dirty_face[6] = SIXPLETTE(false);
int width = 0;
@@ -38,7 +40,7 @@ public:
void resize(int width, int height);
bool create(int width, int height, std::string name);
void clear(const glm::vec4& c);
Snapshot snapshot();
Snapshot snapshot(glm::vec4 dirty_box[6] = nullptr, bool dirty_face[6] = nullptr);
void restore(const Snapshot& snap);
void destroy();
void optimize();