genesys: Simplify ImagePipelineNodeArraySource

merge-requests/244/head
Povilas Kanapickas 2020-05-23 10:39:04 +03:00
rodzic d680724f9e
commit afa798d71a
2 zmienionych plików z 3 dodań i 14 usunięć

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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,