diff --git a/backend/genesys/image_pipeline.cpp b/backend/genesys/image_pipeline.cpp index 18e6b5d34..104d7a7ba 100644 --- a/backend/genesys/image_pipeline.cpp +++ b/backend/genesys/image_pipeline.cpp @@ -349,7 +349,8 @@ bool ImagePipelineNodeInvert::get_next_row_data(std::uint8_t* out_data) } case 1: { auto* data = out_data; - for (std::size_t i = 0; i < num_values; ++i) { + auto num_bytes = (num_values + 7) / 8; + for (std::size_t i = 0; i < num_bytes; ++i) { *data = ~*data; data++; } @@ -499,6 +500,12 @@ ImagePipelineNodeComponentShiftLines::ImagePipelineNodeComponentShiftLines( static_cast(source.get_format())); } extra_height_ = *std::max_element(channel_shifts_.begin(), channel_shifts_.end()); + height_ = source_.get_height(); + if (extra_height_ > height_) { + height_ = 0; + } else { + height_ -= extra_height_; + } } bool ImagePipelineNodeComponentShiftLines::get_next_row_data(std::uint8_t* out_data) @@ -547,6 +554,12 @@ ImagePipelineNodePixelShiftLines::ImagePipelineNodePixelShiftLines( } extra_height_ = *std::max_element(pixel_shifts_.begin(), pixel_shifts_.end()); + height_ = source_.get_height(); + if (extra_height_ > height_) { + height_ = 0; + } else { + height_ -= extra_height_; + } } bool ImagePipelineNodePixelShiftLines::get_next_row_data(std::uint8_t* out_data) diff --git a/backend/genesys/image_pipeline.h b/backend/genesys/image_pipeline.h index 5c373ac43..d590d44d9 100644 --- a/backend/genesys/image_pipeline.h +++ b/backend/genesys/image_pipeline.h @@ -393,7 +393,7 @@ public: unsigned shift_r, unsigned shift_g, unsigned shift_b); std::size_t get_width() const override { return source_.get_width(); } - std::size_t get_height() const override { return source_.get_height() - extra_height_; } + std::size_t get_height() const override { return height_; } PixelFormat get_format() const override { return source_.get_format(); } bool eof() const override { return source_.eof(); } @@ -403,6 +403,7 @@ public: private: ImagePipelineNode& source_; std::size_t extra_height_ = 0; + std::size_t height_ = 0; std::array channel_shifts_; @@ -419,7 +420,7 @@ public: const std::vector& shifts); std::size_t get_width() const override { return source_.get_width(); } - std::size_t get_height() const override { return source_.get_height() - extra_height_; } + std::size_t get_height() const override { return height_; } PixelFormat get_format() const override { return source_.get_format(); } bool eof() const override { return source_.eof(); } @@ -429,6 +430,7 @@ public: private: ImagePipelineNode& source_; std::size_t extra_height_ = 0; + std::size_t height_ = 0; std::vector pixel_shifts_; diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index 0836d6b59..f5b78abd1 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -146,7 +146,7 @@ struct SetupParams { ColorFilter color_filter = static_cast(NOT_SET); - ScanFlag flags; + ScanFlag flags = ScanFlag::NONE; unsigned get_requested_pixels() const {