Extract draw merge branch dispatch object helper
This commit is contained in:
119
src/canvas.cpp
119
src/canvas.cpp
@@ -514,6 +514,16 @@ static void execute_canvas_draw_merge_plane_final_composite(
|
|||||||
bool draw_checkerboard,
|
bool draw_checkerboard,
|
||||||
bool use_blend);
|
bool use_blend);
|
||||||
|
|
||||||
|
static pp::panopainter::LegacyCanvasDrawMergeLayerCompositeExecution make_canvas_draw_merge_branch_dispatch(
|
||||||
|
Canvas& canvas,
|
||||||
|
int plane_index,
|
||||||
|
int layer_index,
|
||||||
|
const std::shared_ptr<Layer>& layer,
|
||||||
|
const Brush& brush,
|
||||||
|
const glm::mat4& ortho,
|
||||||
|
bool copy_blend_destination,
|
||||||
|
bool draw_checkerboard);
|
||||||
|
|
||||||
static void execute_canvas_draw_merge_branch_body(
|
static void execute_canvas_draw_merge_branch_body(
|
||||||
Canvas& canvas,
|
Canvas& canvas,
|
||||||
int plane_index,
|
int plane_index,
|
||||||
@@ -535,55 +545,76 @@ static void execute_canvas_draw_merge_branch_body(
|
|||||||
canvas.m_current_stroke && canvas.m_current_mode == kCanvasMode::Erase && canvas.m_show_tmp && canvas.m_current_layer_idx == layer_index,
|
canvas.m_current_stroke && canvas.m_current_mode == kCanvasMode::Erase && canvas.m_show_tmp && canvas.m_current_layer_idx == layer_index,
|
||||||
canvas.m_current_stroke && canvas.m_show_tmp && canvas.m_current_layer_idx == layer_index,
|
canvas.m_current_stroke && canvas.m_show_tmp && canvas.m_current_layer_idx == layer_index,
|
||||||
use_blend,
|
use_blend,
|
||||||
pp::panopainter::LegacyCanvasDrawMergeLayerCompositeExecution {
|
make_canvas_draw_merge_branch_dispatch(
|
||||||
.execute_temporary_erase = [&] {
|
canvas,
|
||||||
execute_canvas_draw_merge_temporary_erase_dispatch(
|
plane_index,
|
||||||
|
layer_index,
|
||||||
|
layer,
|
||||||
|
brush,
|
||||||
|
ortho,
|
||||||
|
copy_blend_destination,
|
||||||
|
draw_checkerboard));
|
||||||
|
}
|
||||||
|
|
||||||
|
static pp::panopainter::LegacyCanvasDrawMergeLayerCompositeExecution make_canvas_draw_merge_branch_dispatch(
|
||||||
|
Canvas& canvas,
|
||||||
|
int plane_index,
|
||||||
|
int layer_index,
|
||||||
|
const std::shared_ptr<Layer>& layer,
|
||||||
|
const Brush& brush,
|
||||||
|
const glm::mat4& ortho,
|
||||||
|
bool copy_blend_destination,
|
||||||
|
bool draw_checkerboard)
|
||||||
|
{
|
||||||
|
return pp::panopainter::LegacyCanvasDrawMergeLayerCompositeExecution {
|
||||||
|
.execute_temporary_erase = [&] {
|
||||||
|
execute_canvas_draw_merge_temporary_erase_dispatch(
|
||||||
|
canvas,
|
||||||
|
plane_index,
|
||||||
|
layer_index,
|
||||||
|
layer,
|
||||||
|
ortho);
|
||||||
|
},
|
||||||
|
.execute_temporary_paint = [&] {
|
||||||
|
canvas.draw_merge_temporary_paint_branch(
|
||||||
|
layer_index,
|
||||||
|
plane_index,
|
||||||
|
layer,
|
||||||
|
brush,
|
||||||
|
ortho,
|
||||||
|
copy_blend_destination,
|
||||||
|
draw_checkerboard);
|
||||||
|
},
|
||||||
|
.execute_layer_texture = [&] {
|
||||||
|
execute_canvas_draw_merge_layer_texture(
|
||||||
|
pp::panopainter::LegacyCanvasDrawMergeTextureAlphaUniforms {
|
||||||
|
.mvp = ortho,
|
||||||
|
.texture_slot = 0,
|
||||||
|
.alpha = layer->m_opacity,
|
||||||
|
.highlight = layer->m_hightlight,
|
||||||
|
},
|
||||||
|
make_canvas_draw_merge_layer_texture_dispatch(
|
||||||
canvas,
|
canvas,
|
||||||
plane_index,
|
plane_index,
|
||||||
layer_index,
|
layer_index));
|
||||||
layer,
|
},
|
||||||
ortho);
|
.execute_layer_blend = [&] {
|
||||||
},
|
execute_canvas_draw_merge_layer_blend(
|
||||||
.execute_temporary_paint = [&] {
|
pp::panopainter::LegacyCanvasDrawMergeLayerBlendUniforms {
|
||||||
canvas.draw_merge_temporary_paint_branch(
|
.shader = {
|
||||||
layer_index,
|
|
||||||
plane_index,
|
|
||||||
layer,
|
|
||||||
brush,
|
|
||||||
ortho,
|
|
||||||
copy_blend_destination,
|
|
||||||
draw_checkerboard);
|
|
||||||
},
|
|
||||||
.execute_layer_texture = [&] {
|
|
||||||
execute_canvas_draw_merge_layer_texture(
|
|
||||||
pp::panopainter::LegacyCanvasDrawMergeTextureAlphaUniforms {
|
|
||||||
.mvp = ortho,
|
.mvp = ortho,
|
||||||
.texture_slot = 0,
|
.texture_slot = 0,
|
||||||
.alpha = layer->m_opacity,
|
.destination_texture_slot = 2,
|
||||||
.highlight = layer->m_hightlight,
|
.use_destination_texture = copy_blend_destination,
|
||||||
|
.blend_mode = layer->m_blend_mode,
|
||||||
|
.alpha = 1.f,
|
||||||
},
|
},
|
||||||
make_canvas_draw_merge_layer_texture_dispatch(
|
.copy_destination = copy_blend_destination,
|
||||||
canvas,
|
},
|
||||||
plane_index,
|
make_canvas_draw_merge_layer_blend_dispatch(
|
||||||
layer_index));
|
canvas));
|
||||||
},
|
},
|
||||||
.execute_layer_blend = [&] {
|
};
|
||||||
execute_canvas_draw_merge_layer_blend(
|
|
||||||
pp::panopainter::LegacyCanvasDrawMergeLayerBlendUniforms {
|
|
||||||
.shader = {
|
|
||||||
.mvp = ortho,
|
|
||||||
.texture_slot = 0,
|
|
||||||
.destination_texture_slot = 2,
|
|
||||||
.use_destination_texture = copy_blend_destination,
|
|
||||||
.blend_mode = layer->m_blend_mode,
|
|
||||||
.alpha = 1.f,
|
|
||||||
},
|
|
||||||
.copy_destination = copy_blend_destination,
|
|
||||||
},
|
|
||||||
make_canvas_draw_merge_layer_blend_dispatch(
|
|
||||||
canvas));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto make_canvas_draw_merge_temporary_erase_dispatch(
|
static auto make_canvas_draw_merge_temporary_erase_dispatch(
|
||||||
|
|||||||
Reference in New Issue
Block a user