kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify access to nodes that are newly added to image pipeline
rodzic
c9182dc606
commit
8a66829057
|
@ -556,32 +556,22 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
template<class Node, class... Args>
|
template<class Node, class... Args>
|
||||||
void push_first_node(Args&&... args)
|
Node& push_first_node(Args&&... args)
|
||||||
{
|
|
||||||
push_first_node(std::unique_ptr<Node>(new Node(std::forward<Args>(args)...)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Node>
|
|
||||||
void push_first_node(std::unique_ptr<Node>&& node)
|
|
||||||
{
|
{
|
||||||
if (!nodes_.empty()) {
|
if (!nodes_.empty()) {
|
||||||
throw SaneException("Trying to append first node when there are existing nodes");
|
throw SaneException("Trying to append first node when there are existing nodes");
|
||||||
}
|
}
|
||||||
nodes_.emplace_back(std::move(node));
|
nodes_.emplace_back(std::unique_ptr<Node>(new Node(std::forward<Args>(args)...)));
|
||||||
|
return static_cast<Node&>(*nodes_.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Node, class... Args>
|
template<class Node, class... Args>
|
||||||
void push_node(Args&&... args)
|
Node& push_node(Args&&... args)
|
||||||
{
|
{
|
||||||
ensure_node_exists();
|
ensure_node_exists();
|
||||||
push_node(std::unique_ptr<Node>(new Node(*nodes_.back(), std::forward<Args>(args)...)));
|
nodes_.emplace_back(std::unique_ptr<Node>(new Node(*nodes_.back(),
|
||||||
}
|
std::forward<Args>(args)...)));
|
||||||
|
return static_cast<Node&>(*nodes_.back());
|
||||||
template<class Node, class... Args>
|
|
||||||
void push_node(std::unique_ptr<Node>&& node)
|
|
||||||
{
|
|
||||||
ensure_node_exists();
|
|
||||||
nodes_.emplace_back(std::move(node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_next_row_data(std::uint8_t* out_data)
|
bool get_next_row_data(std::uint8_t* out_data)
|
||||||
|
|
|
@ -915,11 +915,9 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes
|
||||||
// certain circumstances.
|
// certain circumstances.
|
||||||
buffer_size = align_multiple_ceil(buffer_size, 2);
|
buffer_size = align_multiple_ceil(buffer_size, 2);
|
||||||
|
|
||||||
auto node = std::unique_ptr<ImagePipelineNodeBufferedCallableSource>(
|
auto& src_node = pipeline.push_first_node<ImagePipelineNodeBufferedCallableSource>(
|
||||||
new ImagePipelineNodeBufferedCallableSource(
|
width, lines, format, buffer_size, read_data_from_usb);
|
||||||
width, lines, format, buffer_size, read_data_from_usb));
|
src_node.set_last_read_multiple(2);
|
||||||
node->set_last_read_multiple(2);
|
|
||||||
pipeline.push_first_node(std::move(node));
|
|
||||||
|
|
||||||
if (log_image_data) {
|
if (log_image_data) {
|
||||||
pipeline.push_node<ImagePipelineNodeDebug>(debug_prefix + "_0_from_usb.tiff");
|
pipeline.push_node<ImagePipelineNodeDebug>(debug_prefix + "_0_from_usb.tiff");
|
||||||
|
|
Ładowanie…
Reference in New Issue