feat(canvas): introduce canvas geometry and rendering helpers

- Added new files `canvas_geometry.cc`, `canvas_geometry.h`, `canvas_rendering.cc`, and `canvas_rendering.h` to encapsulate canvas geometry calculations and rendering logic.
- Refactored `Canvas::DrawBackground` and related methods to utilize the new geometry and rendering helpers, improving code organization and readability.
- Introduced `CanvasState` to consolidate canvas state management, gradually replacing scattered state members.

Benefits:
- Enhances maintainability and clarity of canvas-related code.
- Streamlines rendering operations and geometry calculations, improving overall performance and usability.
This commit is contained in:
scawful
2025-10-16 12:37:13 -04:00
parent 4ba507bde5
commit bfad2f91fb
8 changed files with 735 additions and 65 deletions

View File

@@ -12,6 +12,9 @@
#include "app/gfx/core/bitmap.h"
#include "app/rom.h"
#include "app/gui/canvas/canvas_utils.h"
#include "app/gui/canvas/canvas_state.h"
#include "app/gui/canvas/canvas_geometry.h"
#include "app/gui/canvas/canvas_rendering.h"
#include "app/gui/widgets/palette_editor_widget.h"
#include "app/gfx/util/bpp_format_manager.h"
#include "app/gui/canvas/bpp_format_ui.h"
@@ -414,6 +417,9 @@ class Canvas {
CanvasSelection selection_;
std::unique_ptr<PaletteEditorWidget> palette_editor_;
// Phase 1: Consolidated state (gradually replacing scattered members)
CanvasState state_;
// Automation API (lazy-initialized on first access)
std::unique_ptr<CanvasAutomationAPI> automation_api_;