From afa798d71a440032dcab309468c7e6dcb0b5b852 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sat, 23 May 2020 10:39:04 +0300 Subject: [PATCH] genesys: Simplify ImagePipelineNodeArraySource --- backend/genesys/image_pipeline.cpp | 15 ++------------- backend/genesys/image_pipeline.h | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/backend/genesys/image_pipeline.cpp b/backend/genesys/image_pipeline.cpp index 98ce25254..40ceddcac 100644 --- a/backend/genesys/image_pipeline.cpp +++ b/backend/genesys/image_pipeline.cpp @@ -151,7 +151,6 @@ ImagePipelineNodeArraySource::ImagePipelineNodeArraySource(std::size_t width, st throw SaneException("The given array is too small (%zu bytes). Need at least %zu", data_.size(), size); } - set_remaining_bytes(size); } bool ImagePipelineNodeArraySource::get_next_row_data(std::uint8_t* out_data) @@ -161,21 +160,11 @@ bool ImagePipelineNodeArraySource::get_next_row_data(std::uint8_t* out_data) return false; } - bool got_data = true; - auto row_bytes = get_row_bytes(); - auto bytes_to_ask = consume_remaining_bytes(row_bytes); - if (bytes_to_ask < row_bytes) { - got_data = false; - } - - std::memcpy(out_data, data_.data() + get_row_bytes() * next_row_, bytes_to_ask); + std::memcpy(out_data, data_.data() + row_bytes * next_row_, row_bytes); next_row_++; - if (!got_data) { - eof_ = true; - } - return got_data; + return true; } diff --git a/backend/genesys/image_pipeline.h b/backend/genesys/image_pipeline.h index 0097d3e3c..f85c17574 100644 --- a/backend/genesys/image_pipeline.h +++ b/backend/genesys/image_pipeline.h @@ -181,7 +181,7 @@ private: }; // A pipeline node that produces data from the given array. -class ImagePipelineNodeArraySource : public ImagePipelineNodeBytesSource +class ImagePipelineNodeArraySource : public ImagePipelineNode { public: ImagePipelineNodeArraySource(std::size_t width, std::size_t height, PixelFormat format,