Extract draw merge layer composite orchestration

This commit is contained in:
2026-06-13 18:23:29 +02:00
parent e7813c2ff0
commit 42bc1866ad
4 changed files with 89 additions and 21 deletions

View File

@@ -87,6 +87,13 @@ struct LegacyCanvasDrawMergeLayerTextureExecution {
std::function<void()> unbind_layer_texture;
};
struct LegacyCanvasDrawMergeLayerCompositeExecution {
std::function<void()> execute_temporary_erase;
std::function<void()> execute_temporary_paint;
std::function<void()> execute_layer_texture;
std::function<void()> execute_layer_blend;
};
struct LegacyCanvasDrawMergePlaneSetupUniforms {
LegacyCanvasDrawMergeCheckerboardUniforms checkerboard;
bool use_blend = false;
@@ -304,6 +311,25 @@ inline void execute_legacy_canvas_draw_merge_layer_texture(
execution.unbind_layer_texture();
}
inline void execute_legacy_canvas_draw_merge_layer_composite(
bool is_temporary_erase,
bool is_temporary_paint,
bool use_blend,
const LegacyCanvasDrawMergeLayerCompositeExecution& execution)
{
if (is_temporary_erase) {
execution.execute_temporary_erase();
} else if (is_temporary_paint) {
execution.execute_temporary_paint();
} else {
execution.execute_layer_texture();
}
if (use_blend) {
execution.execute_layer_blend();
}
}
inline void execute_legacy_canvas_draw_merge_plane_setup(
const LegacyCanvasDrawMergePlaneSetupUniforms& uniforms,
const LegacyCanvasDrawMergePlaneSetupExecution& execution)