kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify ImagePipelineNodeArraySource
rodzic
d680724f9e
commit
afa798d71a
|
@ -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",
|
throw SaneException("The given array is too small (%zu bytes). Need at least %zu",
|
||||||
data_.size(), size);
|
data_.size(), size);
|
||||||
}
|
}
|
||||||
set_remaining_bytes(size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImagePipelineNodeArraySource::get_next_row_data(std::uint8_t* out_data)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool got_data = true;
|
|
||||||
|
|
||||||
auto row_bytes = get_row_bytes();
|
auto row_bytes = get_row_bytes();
|
||||||
auto bytes_to_ask = consume_remaining_bytes(row_bytes);
|
std::memcpy(out_data, data_.data() + row_bytes * next_row_, 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);
|
|
||||||
next_row_++;
|
next_row_++;
|
||||||
|
|
||||||
if (!got_data) {
|
return true;
|
||||||
eof_ = true;
|
|
||||||
}
|
|
||||||
return got_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
// A pipeline node that produces data from the given array.
|
// A pipeline node that produces data from the given array.
|
||||||
class ImagePipelineNodeArraySource : public ImagePipelineNodeBytesSource
|
class ImagePipelineNodeArraySource : public ImagePipelineNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImagePipelineNodeArraySource(std::size_t width, std::size_t height, PixelFormat format,
|
ImagePipelineNodeArraySource(std::size_t width, std::size_t height, PixelFormat format,
|
||||||
|
|
Ładowanie…
Reference in New Issue