Narrow stroke execution planning helpers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "assets/image_pixels.h"
|
||||
#include "legacy_canvas_stroke_commit_services.h"
|
||||
#include "paint_renderer/compositor.h"
|
||||
#include "renderer_api/recording_renderer.h"
|
||||
#include "test_harness.h"
|
||||
@@ -1776,6 +1777,61 @@ void plans_canvas_stroke_commit_composite_sequence(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, has_commit_texture_binding(plan, CanvasStrokeCommitTextureRole::pattern, 4));
|
||||
}
|
||||
|
||||
void retained_stroke_commit_runner_clamps_malformed_step_count(pp::tests::Harness& h)
|
||||
{
|
||||
pp::paint_renderer::CanvasStrokeCommitSequencePlan sequence;
|
||||
sequence.step_count = 99U;
|
||||
sequence.steps[0] = CanvasStrokeCommitStep::bind_commit_inputs;
|
||||
sequence.steps[1] = CanvasStrokeCommitStep::composite_draw;
|
||||
|
||||
int bind_inputs = 0;
|
||||
int paint_draws = 0;
|
||||
int erase_draws = 0;
|
||||
int started = 0;
|
||||
int restored = 0;
|
||||
int published = 0;
|
||||
int timelapse = 0;
|
||||
|
||||
const auto result = pp::panopainter::execute_legacy_canvas_stroke_commit_sequence(
|
||||
pp::panopainter::LegacyCanvasStrokeCommitRequest {
|
||||
.context = "test",
|
||||
.faces = {
|
||||
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 0, .dirty = true },
|
||||
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 1, .dirty = false },
|
||||
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 2, .dirty = true },
|
||||
},
|
||||
.sequence = sequence,
|
||||
.callbacks = {
|
||||
.mark_commit_started = [&]() { ++started; },
|
||||
.capture_render_state = []() {},
|
||||
.prepare_render_state = []() {},
|
||||
.restore_render_state = [&]() { ++restored; },
|
||||
.publish_history = [&]() { ++published; },
|
||||
.capture_timelapse_frame = [&]() { ++timelapse; },
|
||||
.bind_layer_framebuffer = [](int) {},
|
||||
.capture_history_region = [](int) {},
|
||||
.apply_layer_dirty_region = [](int) {},
|
||||
.copy_layer_to_commit_destination = [](int) {},
|
||||
.bind_commit_inputs = [&](int) { ++bind_inputs; },
|
||||
.execute_erase_composite = [&](int) { ++erase_draws; },
|
||||
.execute_paint_composite = [&](int) { ++paint_draws; },
|
||||
.copy_committed_to_dilate_source = [](int) {},
|
||||
.execute_commit_dilate = [](int) {},
|
||||
.unbind_layer_framebuffer = [](int) {},
|
||||
},
|
||||
});
|
||||
|
||||
PP_EXPECT(h, result.ok);
|
||||
PP_EXPECT(h, result.committed_faces == 2);
|
||||
PP_EXPECT(h, bind_inputs == 2);
|
||||
PP_EXPECT(h, paint_draws == 2);
|
||||
PP_EXPECT(h, erase_draws == 0);
|
||||
PP_EXPECT(h, started == 1);
|
||||
PP_EXPECT(h, restored == 1);
|
||||
PP_EXPECT(h, published == 1);
|
||||
PP_EXPECT(h, timelapse == 1);
|
||||
}
|
||||
|
||||
void plans_stroke_preview_composite_for_simple_brush(pp::tests::Harness& h)
|
||||
{
|
||||
const auto plan = plan_stroke_preview_composite(StrokePreviewCompositeRequest {});
|
||||
@@ -1841,6 +1897,27 @@ void plans_stroke_preview_composite_with_pattern_input(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::pattern, 4));
|
||||
}
|
||||
|
||||
void plans_stroke_preview_composite_with_all_retained_inputs(pp::tests::Harness& h)
|
||||
{
|
||||
const auto plan = plan_stroke_preview_composite(
|
||||
StrokePreviewCompositeRequest {
|
||||
.uses_mixer = true,
|
||||
.uses_dual = true,
|
||||
.uses_pattern = true,
|
||||
});
|
||||
|
||||
expect_preview_sequence(h, plan);
|
||||
PP_EXPECT(h, plan.uses_mixer);
|
||||
PP_EXPECT(h, plan.uses_dual);
|
||||
PP_EXPECT(h, plan.uses_pattern);
|
||||
PP_EXPECT(h, plan.texture_slot_count == 5U);
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::background, 0));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::stroke, 1));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::dual, 3));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::pattern, 4));
|
||||
PP_EXPECT(h, has_preview_texture_slot(plan, StrokePreviewTextureRole::mixer, 3));
|
||||
}
|
||||
|
||||
void plans_canvas_blend_gate_from_persisted_indices(pp::tests::Harness& h)
|
||||
{
|
||||
const std::vector<int> normal_layers { 0, 0, 0 };
|
||||
@@ -2264,10 +2341,16 @@ int main()
|
||||
harness.run("plans_canvas_stroke_dual_material_intent", plans_canvas_stroke_dual_material_intent);
|
||||
harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence);
|
||||
harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence);
|
||||
harness.run(
|
||||
"retained_stroke_commit_runner_clamps_malformed_step_count",
|
||||
retained_stroke_commit_runner_clamps_malformed_step_count);
|
||||
harness.run("plans_stroke_preview_composite_for_simple_brush", plans_stroke_preview_composite_for_simple_brush);
|
||||
harness.run("plans_stroke_preview_composite_with_mixer_input", plans_stroke_preview_composite_with_mixer_input);
|
||||
harness.run("plans_stroke_preview_composite_with_dual_input", plans_stroke_preview_composite_with_dual_input);
|
||||
harness.run("plans_stroke_preview_composite_with_pattern_input", plans_stroke_preview_composite_with_pattern_input);
|
||||
harness.run(
|
||||
"plans_stroke_preview_composite_with_all_retained_inputs",
|
||||
plans_stroke_preview_composite_with_all_retained_inputs);
|
||||
harness.run("plans_canvas_blend_gate_from_persisted_indices", plans_canvas_blend_gate_from_persisted_indices);
|
||||
harness.run("canvas_blend_gate_preserves_legacy_fallbacks", canvas_blend_gate_preserves_legacy_fallbacks);
|
||||
harness.run("plans_canvas_stroke_feedback_paths", plans_canvas_stroke_feedback_paths);
|
||||
|
||||
Reference in New Issue
Block a user