From 9da868abbe640297a81c8a5e32cdc7f7776c295e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 3 Jan 2022 17:10:57 +0000 Subject: Add transform_array Wraps std::transform to transform one array into another. --- ui/font.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/font.cpp b/ui/font.cpp index 712818d..e5432b8 100644 --- a/ui/font.cpp +++ b/ui/font.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include // IWYU pragma: no_forward_declare FT_LibraryRec_ @@ -173,12 +174,11 @@ Font::render(const std::string_view chars) const const auto charPos = pos + glm::vec2 {ch.bearing.x, ch.bearing.y - static_cast(ch.size.y)}; const auto size = glm::vec2 {ch.size}; - Quad q; - std::transform(C.begin(), C.end(), q.begin(), [&size, &charPos, &ch, this](const auto & c) { - return (charPos + (size * c.first)) - || ((glm::vec2 {ch.position} + (glm::vec2 {ch.size} * c.second)) / glm::vec2 {this->size}); - }); - out[fontTextures[ch.textureIdx].texture].emplace_back(q); + out[fontTextures[ch.textureIdx].texture].emplace_back( + transform_array(C, [&size, &charPos, &ch, this](const auto & c) { + return (charPos + (size * c.first)) + || ((glm::vec2 {ch.position} + (glm::vec2 {ch.size} * c.second)) / glm::vec2 {this->size}); + })); pos.x += static_cast(ch.advance); } -- cgit v1.2.3