Route stroke pad planning through helper
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "paint_renderer/compositor.h"
|
||||
#include "../libs/glm/glm/glm.hpp"
|
||||
#include "util.h"
|
||||
|
||||
#include <array>
|
||||
@@ -46,6 +47,17 @@ struct LegacyCanvasStrokeFaceDirtyResult {
|
||||
bool pass_dirty = false;
|
||||
};
|
||||
|
||||
struct LegacyCanvasStrokePadRegionRequest {
|
||||
pp::renderer::Extent2D extent {};
|
||||
glm::vec4 pass_dirty_box {};
|
||||
};
|
||||
|
||||
struct LegacyCanvasStrokePadRegionResult {
|
||||
bool has_pixels = false;
|
||||
pp::paint_renderer::CanvasStrokeCopyRegion copy_region {};
|
||||
std::array<pp::paint_renderer::CanvasStrokePoint, 6> ndc_quad {};
|
||||
};
|
||||
|
||||
[[nodiscard]] inline pp::paint_renderer::CanvasStrokeBox legacy_canvas_stroke_box(glm::vec4 box) noexcept
|
||||
{
|
||||
return pp::paint_renderer::CanvasStrokeBox {
|
||||
@@ -62,6 +74,22 @@ struct LegacyCanvasStrokeFaceDirtyResult {
|
||||
return glm::vec4(box.min_x, box.min_y, box.max_x, box.max_y);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokePadRegionResult plan_legacy_canvas_stroke_pad_region(
|
||||
const LegacyCanvasStrokePadRegionRequest& request) noexcept
|
||||
{
|
||||
const auto plan = pp::paint_renderer::plan_canvas_stroke_pad_region(
|
||||
pp::paint_renderer::CanvasStrokePadRegionRequest {
|
||||
.extent = request.extent,
|
||||
.pass_dirty_box = legacy_canvas_stroke_box(request.pass_dirty_box),
|
||||
});
|
||||
|
||||
return LegacyCanvasStrokePadRegionResult {
|
||||
.has_pixels = plan.has_pixels,
|
||||
.copy_region = plan.copy_region,
|
||||
.ndc_quad = plan.ndc_quad,
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeFaceDirtyResult plan_legacy_canvas_stroke_face_dirty_update(
|
||||
const LegacyCanvasStrokeFaceDirtyRequest& request) noexcept
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user