Skip to content
Snippets Groups Projects
Verified Commit 392c07ad authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Faster blurhash decode

parent 96c4d057
No related branches found
No related tags found
No related merge requests found
Pipeline #5460 failed
......@@ -22,9 +22,14 @@ BlurhashRunnable::run()
return;
}
auto blurhashDecodeSize = m_requestedSize;
if (blurhashDecodeSize.height() > 100 && blurhashDecodeSize.width() > 100) {
blurhashDecodeSize.scale(100, 100, Qt::AspectRatioMode::KeepAspectRatio);
}
auto decoded = blurhash::decode(QUrl::fromPercentEncoding(m_id.toUtf8()).toStdString(),
m_requestedSize.width(),
m_requestedSize.height());
blurhashDecodeSize.width(),
blurhashDecodeSize.height());
if (decoded.image.empty()) {
emit error(QStringLiteral("Failed decode!"));
return;
......@@ -36,5 +41,7 @@ BlurhashRunnable::run()
(int)decoded.width * 3,
QImage::Format_RGB888);
image = image.scaled(m_requestedSize);
emit done(image.convertToFormat(QImage::Format_RGB32));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment