Started work on cache for canvas components

This commit is contained in:
Yousef Khadadeh 2025-07-19 15:57:09 +03:00
parent c7842c2924
commit 1095b91cec
15 changed files with 261 additions and 74 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include "../DrawData.hpp"
#include "DrawingProgramCache.hpp"
#include "cereal/archives/portable_binary.hpp"
#include <include/core/SkCanvas.h>
#include <include/core/SkPath.h>
@ -44,9 +45,15 @@ class DrawingProgram {
void add_file_to_canvas_by_path(const std::string& filePath, Vector2f dropPos, bool addInSameThread);
void add_file_to_canvas_by_data(const std::string& fileName, std::string_view fileBuffer, Vector2f dropPos);
void parallel_loop_all_components(std::function<void(const std::shared_ptr<CollabList<std::shared_ptr<DrawComponent>, ServerClientID>::ObjectInfo>&)> func);
bool colliderAllocated = false;
CollabList<std::shared_ptr<DrawComponent>, ServerClientID> components;
DrawingProgramCache compCache;
typedef CollabList<std::shared_ptr<DrawComponent>, ServerClientID> CollabListType;
CollabListType components;
Vector4f* get_foreground_color_ptr();
private:
@ -72,6 +79,8 @@ class DrawingProgram {
void add_undo_place_component(uint64_t placement, const std::shared_ptr<DrawComponent>& comp);
void add_undo_place_components(uint64_t placement, const std::vector<std::shared_ptr<DrawComponent>>& comps);
bool disableCache = true;
BrushTool brushTool;
EraserTool eraserTool;
RectSelectTool rectSelectTool;