Narrow stroke execution planning helpers
This commit is contained in:
46
src/legacy_node_stroke_preview_execution_services.h
Normal file
46
src/legacy_node_stroke_preview_execution_services.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "paint_renderer/compositor.h"
|
||||
#include "renderer_api/renderer_api.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
[[nodiscard]] inline pp::paint_renderer::CanvasStrokeFeedbackPlan plan_legacy_node_stroke_preview_feedback(
|
||||
pp::renderer::RenderDeviceFeatures features,
|
||||
int width,
|
||||
int height) noexcept
|
||||
{
|
||||
const auto plan = pp::paint_renderer::plan_canvas_stroke_feedback(
|
||||
features,
|
||||
pp::renderer::Extent2D {
|
||||
.width = static_cast<std::uint32_t>(std::max(width, 0)),
|
||||
.height = static_cast<std::uint32_t>(std::max(height, 0)),
|
||||
});
|
||||
if (plan) {
|
||||
return plan.value();
|
||||
}
|
||||
|
||||
pp::paint_renderer::CanvasStrokeFeedbackPlan fallback;
|
||||
fallback.compatibility_fallback = true;
|
||||
fallback.path = pp::paint_renderer::StrokeCompositePath::ping_pong_textures;
|
||||
fallback.requires_auxiliary_texture = true;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline pp::paint_renderer::StrokePreviewCompositePlan plan_legacy_node_stroke_preview_composite(
|
||||
bool uses_mixer,
|
||||
bool uses_dual,
|
||||
bool uses_pattern) noexcept
|
||||
{
|
||||
return pp::paint_renderer::plan_stroke_preview_composite(
|
||||
pp::paint_renderer::StrokePreviewCompositeRequest {
|
||||
.uses_mixer = uses_mixer,
|
||||
.uses_dual = uses_dual,
|
||||
.uses_pattern = uses_pattern,
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
Reference in New Issue
Block a user