From d0fc7350df5d2abbee636ef152872f056a1e8ac0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 29 May 2019 17:04:24 -0700 Subject: [PATCH] ircd::magick: Simplify thumbnail interface; no result copy. --- include/ircd/magick.h | 8 +++++--- modules/media/magick.cc | 12 +++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/ircd/magick.h b/include/ircd/magick.h index b8c3da597..8c50737c5 100644 --- a/include/ircd/magick.h +++ b/include/ircd/magick.h @@ -22,9 +22,11 @@ namespace ircd::magick } struct ircd::magick::thumbnail -:const_buffer { + using dimensions = std::pair; // x, y + using result_closure = std::function; + thumbnail(const const_buffer &in, - const mutable_buffer &out, - const std::pair &xy); + const dimensions &, + const result_closure &); }; diff --git a/modules/media/magick.cc b/modules/media/magick.cc index 7158931ef..c0ae8b4ca 100644 --- a/modules/media/magick.cc +++ b/modules/media/magick.cc @@ -122,9 +122,8 @@ ircd::magick::version() // ircd::magick::thumbnail::thumbnail(const const_buffer &in, - const mutable_buffer &out, - const std::pair &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(output_data), output_size }; - return const_buffer - { - data(out), copy(out, result) - }; -}()} -{ + closure(result); } //