mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::magick: Simplify thumbnail interface; no result copy.
This commit is contained in:
parent
28f86802d2
commit
d0fc7350df
2 changed files with 8 additions and 12 deletions
|
@ -22,9 +22,11 @@ namespace ircd::magick
|
|||
}
|
||||
|
||||
struct ircd::magick::thumbnail
|
||||
:const_buffer
|
||||
{
|
||||
using dimensions = std::pair<size_t, size_t>; // x, y
|
||||
using result_closure = std::function<void (const const_buffer &)>;
|
||||
|
||||
thumbnail(const const_buffer &in,
|
||||
const mutable_buffer &out,
|
||||
const std::pair<size_t, size_t> &xy);
|
||||
const dimensions &,
|
||||
const result_closure &);
|
||||
};
|
||||
|
|
|
@ -122,9 +122,8 @@ ircd::magick::version()
|
|||
//
|
||||
|
||||
ircd::magick::thumbnail::thumbnail(const const_buffer &in,
|
||||
const mutable_buffer &out,
|
||||
const std::pair<size_t, size_t> &xy)
|
||||
:const_buffer{[&in, &out, &xy]
|
||||
const dimensions &xy,
|
||||
const result_closure &closure)
|
||||
{
|
||||
const custom_ptr<::ImageInfo> input_info
|
||||
{
|
||||
|
@ -157,12 +156,7 @@ ircd::magick::thumbnail::thumbnail(const const_buffer &in,
|
|||
reinterpret_cast<char *>(output_data), output_size
|
||||
};
|
||||
|
||||
return const_buffer
|
||||
{
|
||||
data(out), copy(out, result)
|
||||
};
|
||||
}()}
|
||||
{
|
||||
closure(result);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue