Narrow stroke execution planning helpers
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "paint_renderer/compositor.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
@@ -45,6 +46,12 @@ struct LegacyCanvasStrokeCommitResult {
|
||||
int committed_faces = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline std::size_t legacy_canvas_stroke_commit_step_count(
|
||||
const pp::paint_renderer::CanvasStrokeCommitSequencePlan& sequence) noexcept
|
||||
{
|
||||
return std::min(sequence.step_count, sequence.steps.size());
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool legacy_canvas_stroke_commit_callbacks_ready(
|
||||
const LegacyCanvasStrokeCommitCallbacks& callbacks) noexcept
|
||||
{
|
||||
@@ -85,7 +92,8 @@ struct LegacyCanvasStrokeCommitResult {
|
||||
|
||||
request.callbacks.bind_layer_framebuffer(face.index);
|
||||
|
||||
for (std::size_t step_index = 0; step_index < request.sequence.step_count; ++step_index) {
|
||||
const auto step_count = legacy_canvas_stroke_commit_step_count(request.sequence);
|
||||
for (std::size_t step_index = 0; step_index < step_count; ++step_index) {
|
||||
switch (request.sequence.steps[step_index]) {
|
||||
case pp::paint_renderer::CanvasStrokeCommitStep::readback_history_region:
|
||||
request.callbacks.capture_history_region(face.index);
|
||||
|
||||
Reference in New Issue
Block a user