Plan live stroke rasterization boundaries
This commit is contained in:
35
src/legacy_canvas_stroke_services.h
Normal file
35
src/legacy_canvas_stroke_services.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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::CanvasStrokeRasterizationPlan plan_legacy_canvas_stroke_rasterization(
|
||||
pp::renderer::RenderDeviceFeatures features,
|
||||
int width,
|
||||
int height) noexcept
|
||||
{
|
||||
const auto plan = pp::paint_renderer::plan_canvas_stroke_rasterization(
|
||||
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::CanvasStrokeRasterizationPlan fallback;
|
||||
fallback.feedback.compatibility_fallback = true;
|
||||
fallback.feedback.path = pp::paint_renderer::StrokeCompositePath::ping_pong_textures;
|
||||
fallback.feedback.requires_auxiliary_texture = true;
|
||||
fallback.copy_stroke_destination = true;
|
||||
fallback.compatibility_fallback = true;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
Reference in New Issue
Block a user