From 91f3b7f3dc59f1fabd89cf5d1794b1949763b0fe Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 07:00:28 +0200 Subject: [PATCH] Route stroke dirty mutation through helper --- docs/modernization/debt.md | 4 +++ docs/modernization/roadmap.md | 4 +++ docs/modernization/tasks.md | 6 ++++ src/canvas.cpp | 29 ++++++++++--------- src/legacy_canvas_stroke_execution_services.h | 21 ++++++++++++++ 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 9c6cbf2..b4d7d51 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw` current and + dual stroke dirty-box mutation now routes through the retained stroke + execution helper; framebuffer binding, shader uniform timing, sampler/texture + binding, and live draw execution remain retained. - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_commit` retained commit input texture/sampler binding, erase/composite draw dispatch, committed-copy-to-dilate-source, and dilate draw now route through diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index b9a0af9..4d6a376 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -3100,6 +3100,10 @@ Results: the retained stroke execution helper, while framebuffer binding, shader uniform timing, dirty-box mutation, sampler/texture binding, and live draw execution remain retained. +- `Canvas::stroke_draw` current and dual stroke dirty-box mutation now shares + the retained stroke execution helper, while framebuffer binding, shader + uniform timing, sampler/texture binding, and live draw execution remain + retained. - Remaining simple color, hue, color-quad, grid heightmap, and pen/line preview shader setup in UI nodes and canvas modes now shares retained helper surfaces, while geometry, texture/sampler binding, blend/depth state, diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index ba53ff2..8883e4f 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -509,6 +509,12 @@ Done Checks: Progress Notes: +- 2026-06-13: `Canvas::stroke_draw` current and dual stroke dirty-box mutation + now routes through `legacy_canvas_stroke_execution_services.h`; framebuffer + binding, shader uniform timing, sampler/texture binding, and draw execution + remain local to Canvas. Next slice should wrap the retained per-face + framebuffer/sample callback ordering without rewriting the new pad-pass or + commit executors. - 2026-06-13: `Canvas::stroke_commit` now routes retained commit input texture/sampler binding, erase/composite draw dispatch, committed-copy, and dilate draw through `legacy_canvas_stroke_commit_services.h`; history diff --git a/src/canvas.cpp b/src/canvas.cpp index acb4ae9..945147e 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -716,16 +716,16 @@ void Canvas::stroke_draw() m_tmp[i].unbindFramebuffer(); - const auto dirty_update = pp::panopainter::plan_legacy_canvas_stroke_face_dirty_update( + const auto dirty_update = pp::panopainter::apply_legacy_canvas_stroke_face_dirty_update( pp::panopainter::LegacyCanvasStrokeFaceDirtyRequest { .extent = stroke_extent, .previous_accumulated_dirty_box = m_dirty_box[i], .previous_pass_dirty_box = box_face[i], .sample_dirty_box = box_sample, .include_in_committed_dirty_box = true, - }); - m_dirty_box[i] = dirty_update.accumulated_dirty_box; - box_face[i] = dirty_update.pass_dirty_box; + }, + m_dirty_box[i], + &box_face[i]); // TODO: maybe average color? pad_color = f.col; }); @@ -820,16 +820,17 @@ void Canvas::stroke_draw() m_tmp_dual[i].unbindFramebuffer(); // this mode overflows the main brush boundries - const auto dirty_update = pp::panopainter::plan_legacy_canvas_stroke_face_dirty_update( - pp::panopainter::LegacyCanvasStrokeFaceDirtyRequest { - .extent = stroke_extent, - .previous_accumulated_dirty_box = m_dirty_box[i], - .previous_pass_dirty_box = box_sample, - .sample_dirty_box = box_sample, - .include_in_committed_dirty_box = - stroke_material.composite_pass.dual_blend_mode == 0, - }); - m_dirty_box[i] = dirty_update.accumulated_dirty_box; + [[maybe_unused]] const auto dirty_update = + pp::panopainter::apply_legacy_canvas_stroke_face_dirty_update( + pp::panopainter::LegacyCanvasStrokeFaceDirtyRequest { + .extent = stroke_extent, + .previous_accumulated_dirty_box = m_dirty_box[i], + .previous_pass_dirty_box = box_sample, + .sample_dirty_box = box_sample, + .include_in_committed_dirty_box = + stroke_material.composite_pass.dual_blend_mode == 0, + }, + m_dirty_box[i]); }); } diff --git a/src/legacy_canvas_stroke_execution_services.h b/src/legacy_canvas_stroke_execution_services.h index 406f7ab..a39e472 100644 --- a/src/legacy_canvas_stroke_execution_services.h +++ b/src/legacy_canvas_stroke_execution_services.h @@ -246,6 +246,27 @@ std::size_t execute_legacy_canvas_stroke_frame_faces( }; } +[[nodiscard]] inline LegacyCanvasStrokeFaceDirtyResult apply_legacy_canvas_stroke_face_dirty_update( + const LegacyCanvasStrokeFaceDirtyRequest& request, + glm::vec4& accumulated_dirty_box, + glm::vec4* pass_dirty_box = nullptr, + bool* committed_dirty = nullptr, + bool* pass_dirty = nullptr) noexcept +{ + const auto result = plan_legacy_canvas_stroke_face_dirty_update(request); + accumulated_dirty_box = result.accumulated_dirty_box; + if (pass_dirty_box) { + *pass_dirty_box = result.pass_dirty_box; + } + if (committed_dirty) { + *committed_dirty = result.committed_dirty; + } + if (pass_dirty) { + *pass_dirty = result.pass_dirty; + } + return result; +} + [[nodiscard]] inline LegacyCanvasStrokePadExecutionResult execute_legacy_canvas_stroke_pad_faces( const LegacyCanvasStrokePadExecutionRequest& request) {