Merge branch 'genesys-misc-fixes' into 'master'

genesys: Miscellaneous fixes

See merge request sane-project/backends!474
merge-requests/244/head
Povilas Kanapickas 2020-05-25 22:29:03 +00:00
commit 64b69331d3
3 zmienionych plików z 24 dodań i 25 usunięć

Wyświetl plik

@ -233,7 +233,7 @@ void write_tiff_file(const std::string& filename, const void* data, int depth, i
// we don't need to handle endian because libtiff will handle that
for (int iline = 0; iline < lines; ++iline) {
const auto* line_data = data_ptr + bytes_per_line;
const auto* line_data = data_ptr + bytes_per_line * iline;
TIFFWriteScanline(image, const_cast<std::uint8_t*>(line_data), iline, 0);
}
TIFFClose(image);

Wyświetl plik

@ -524,8 +524,19 @@ class ImagePipelineStack
{
public:
ImagePipelineStack() {}
ImagePipelineStack(ImagePipelineStack&&) = default;
ImagePipelineStack& operator=(ImagePipelineStack&&) = default;
ImagePipelineStack(ImagePipelineStack&& other)
{
clear();
nodes_ = std::move(other.nodes_);
}
ImagePipelineStack& operator=(ImagePipelineStack&& other)
{
clear();
nodes_ = std::move(other.nodes_);
return *this;
}
~ImagePipelineStack() { clear(); }
std::size_t get_input_width() const;
@ -545,32 +556,22 @@ public:
void clear();
template<class Node, class... Args>
void 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)
Node& push_first_node(Args&&... args)
{
if (!nodes_.empty()) {
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>
void push_node(Args&&... args)
Node& push_node(Args&&... args)
{
ensure_node_exists();
push_node(std::unique_ptr<Node>(new Node(*nodes_.back(), std::forward<Args>(args)...)));
}
template<class Node, class... Args>
void push_node(std::unique_ptr<Node>&& node)
{
ensure_node_exists();
nodes_.emplace_back(std::move(node));
nodes_.emplace_back(std::unique_ptr<Node>(new Node(*nodes_.back(),
std::forward<Args>(args)...)));
return static_cast<Node&>(*nodes_.back());
}
bool get_next_row_data(std::uint8_t* out_data)

Wyświetl plik

@ -974,11 +974,9 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes
// certain circumstances.
buffer_size = align_multiple_ceil(buffer_size, 2);
auto node = std::unique_ptr<ImagePipelineNodeBufferedCallableSource>(
new ImagePipelineNodeBufferedCallableSource(
width, lines, format, buffer_size, read_data_from_usb));
node->set_last_read_multiple(2);
pipeline.push_first_node(std::move(node));
auto& src_node = pipeline.push_first_node<ImagePipelineNodeBufferedCallableSource>(
width, lines, format, buffer_size, read_data_from_usb);
src_node.set_last_read_multiple(2);
if (log_image_data) {
pipeline.push_node<ImagePipelineNodeDebug>(debug_prefix + "_0_from_usb.tiff");