Move canvas action pixel mapping to renderer gl
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# Build And Platform Inventory
|
# Build And Platform Inventory
|
||||||
|
|
||||||
Status: live
|
Status: live
|
||||||
Last updated: 2026-06-01
|
Last updated: 2026-06-02
|
||||||
|
|
||||||
This inventory records the known build surfaces during the CMake migration.
|
This inventory records the known build surfaces during the CMake migration.
|
||||||
Keep it updated as platform paths move to shared CMake targets.
|
Keep it updated as platform paths move to shared CMake targets.
|
||||||
@@ -164,7 +164,9 @@ Known local toolchain state:
|
|||||||
used before runtime capability detection are cataloged here. Legacy font
|
used before runtime capability detection are cataloged here. Legacy font
|
||||||
atlas texture formats, text mesh buffer targets, attribute component and
|
atlas texture formats, text mesh buffer targets, attribute component and
|
||||||
normalization tokens, draw primitive/index type, upload usage, and active
|
normalization tokens, draw primitive/index type, upload usage, and active
|
||||||
texture unit selection also consume the backend mapping.
|
texture unit selection also consume the backend mapping. Canvas undo/redo
|
||||||
|
dirty-region texture updates and readbacks also consume the backend-owned 2D
|
||||||
|
texture target, RGBA pixel format, and unsigned-byte component mapping.
|
||||||
- `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test
|
- `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test
|
||||||
for the current headless component matrix; see DEBT-0007 for remaining app
|
for the current headless component matrix; see DEBT-0007 for remaining app
|
||||||
and platform triplet migration.
|
and platform triplet migration.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# PanoPainter Modernization Roadmap
|
# PanoPainter Modernization Roadmap
|
||||||
|
|
||||||
Status: live
|
Status: live
|
||||||
Last updated: 2026-06-01
|
Last updated: 2026-06-02
|
||||||
|
|
||||||
This is the living roadmap for modernizing PanoPainter into independently
|
This is the living roadmap for modernizing PanoPainter into independently
|
||||||
testable C++23 components while retaining all existing functionality. Keep this
|
testable C++23 components while retaining all existing functionality. Keep this
|
||||||
@@ -430,6 +430,9 @@ capability detection also live in `pp_renderer_gl`. Legacy font atlas texture
|
|||||||
formats, text mesh buffer targets, attribute component/normalization, draw
|
formats, text mesh buffer targets, attribute component/normalization, draw
|
||||||
primitive/index type, upload usage, and active texture unit selection also
|
primitive/index type, upload usage, and active texture unit selection also
|
||||||
delegate to `pp_renderer_gl`; `Font` no longer spells GL enum names directly.
|
delegate to `pp_renderer_gl`; `Font` no longer spells GL enum names directly.
|
||||||
|
Canvas undo/redo dirty-region texture updates and readbacks now also delegate
|
||||||
|
their 2D texture target, RGBA pixel format, and unsigned-byte component type
|
||||||
|
mapping to `pp_renderer_gl`.
|
||||||
The existing renderer classes are not yet fully
|
The existing renderer classes are not yet fully
|
||||||
behind the renderer interfaces.
|
behind the renderer interfaces.
|
||||||
|
|
||||||
@@ -595,7 +598,7 @@ Acceptance for each phase:
|
|||||||
|
|
||||||
## Verified Commands
|
## Verified Commands
|
||||||
|
|
||||||
Last verified on 2026-06-01:
|
Last verified on 2026-06-02:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
cmake --preset windows-msvc-default
|
cmake --preset windows-msvc-default
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "canvas_actions.h"
|
#include "canvas_actions.h"
|
||||||
#include "node_panel_layer.h"
|
#include "node_panel_layer.h"
|
||||||
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
|
|
||||||
void ActionStroke::undo()
|
void ActionStroke::undo()
|
||||||
{
|
{
|
||||||
@@ -36,8 +37,21 @@ void ActionStroke::undo()
|
|||||||
{
|
{
|
||||||
App::I->render_task([&]
|
App::I->render_task([&]
|
||||||
{
|
{
|
||||||
|
const auto texture_target = pp::renderer::gl::texture_2d_target();
|
||||||
|
const auto pixel_format = pp::renderer::gl::rgba_pixel_format();
|
||||||
|
const auto component_type = pp::renderer::gl::unsigned_byte_component_type();
|
||||||
|
|
||||||
m_canvas->m_layers[m_layer_idx]->rtt(i, m_frame_idx).bindTexture();
|
m_canvas->m_layers[m_layer_idx]->rtt(i, m_frame_idx).bindTexture();
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, (int)m_box[i].x, (int)m_box[i].y, (int)box_sz.x, (int)box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, m_image[i].get());
|
glTexSubImage2D(
|
||||||
|
texture_target,
|
||||||
|
0,
|
||||||
|
(int)m_box[i].x,
|
||||||
|
(int)m_box[i].y,
|
||||||
|
(int)box_sz.x,
|
||||||
|
(int)box_sz.y,
|
||||||
|
pixel_format,
|
||||||
|
component_type,
|
||||||
|
m_image[i].get());
|
||||||
m_canvas->m_layers[m_layer_idx]->rtt(i, m_frame_idx).unbindTexture();
|
m_canvas->m_layers[m_layer_idx]->rtt(i, m_frame_idx).unbindTexture();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -76,11 +90,22 @@ Action* ActionStroke::get_redo()
|
|||||||
glm::vec2 box_sz = zw(box) - xy(box);
|
glm::vec2 box_sz = zw(box) - xy(box);
|
||||||
if (box_sz.x > 0 && box_sz.y > 0 && box_sz.x <= layer->w && box_sz.y <= layer->h)
|
if (box_sz.x > 0 && box_sz.y > 0 && box_sz.x <= layer->w && box_sz.y <= layer->h)
|
||||||
{
|
{
|
||||||
action->m_image[i] = std::make_unique<uint8_t[]>(box_sz.x * box_sz.y * 4);
|
action->m_image[i] = std::make_unique<uint8_t[]>(
|
||||||
|
static_cast<size_t>((int)box_sz.x) * static_cast<size_t>((int)box_sz.y) * 4U);
|
||||||
App::I->render_task([&]
|
App::I->render_task([&]
|
||||||
{
|
{
|
||||||
|
const auto pixel_format = pp::renderer::gl::rgba_pixel_format();
|
||||||
|
const auto component_type = pp::renderer::gl::unsigned_byte_component_type();
|
||||||
|
|
||||||
layer->rtt(i, m_frame_idx).bindFramebuffer();
|
layer->rtt(i, m_frame_idx).bindFramebuffer();
|
||||||
glReadPixels(box_or.x, box_or.y, box_sz.x, box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, action->m_image[i].get());
|
glReadPixels(
|
||||||
|
(int)box_or.x,
|
||||||
|
(int)box_or.y,
|
||||||
|
(int)box_sz.x,
|
||||||
|
(int)box_sz.y,
|
||||||
|
pixel_format,
|
||||||
|
component_type,
|
||||||
|
action->m_image[i].get());
|
||||||
layer->rtt(i, m_frame_idx).unbindFramebuffer();
|
layer->rtt(i, m_frame_idx).unbindFramebuffer();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user