mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 04:28:49 +03:00
Reduce allocations
This commit is contained in:
parent
8272d00b50
commit
9b94940251
1 changed files with 2 additions and 1 deletions
|
@ -260,6 +260,7 @@ decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPi
|
|||
|
||||
Components components{};
|
||||
std::vector<Color> values;
|
||||
values.reserve(blurhash.size() / 2);
|
||||
try {
|
||||
components = unpackComponents(decode83(blurhash.substr(0, 1)));
|
||||
|
||||
|
@ -277,7 +278,7 @@ decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPi
|
|||
return {};
|
||||
}
|
||||
|
||||
i.image.reserve(height * width * 3);
|
||||
i.image.reserve(height * width * bytesPerPixel);
|
||||
|
||||
for (size_t y = 0; y < height; y++) {
|
||||
for (size_t x = 0; x < width; x++) {
|
||||
|
|
Loading…
Reference in a new issue