From 5f6261c0cff3910ca9a586e0314c655f48f4b9a5 Mon Sep 17 00:00:00 2001 From: nerix Date: Mon, 26 Feb 2024 19:38:30 +0100 Subject: [PATCH] feat: use 4x images on 7TV instead of 3x (#5209) --- CHANGELOG.md | 1 + src/providers/seventv/SeventvEmotes.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c56ac5e38..b3cd6ba65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ - Minor: Allow theming of tab live and rerun indicators. (#5188) - Minor: Added a fallback theme field to custom themes that will be used in case the custom theme does not contain a color Chatterino needs. If no fallback theme is specified, we'll pull the color from the included Dark or Light theme. (#5198) - Minor: Image links now reflect the scale of their image instead of an internal label. (#5201) +- Minor: 7TV emotes now have a 4x image rather than a 3x image. (#5209) - Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840) - Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848) - Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834) diff --git a/src/providers/seventv/SeventvEmotes.cpp b/src/providers/seventv/SeventvEmotes.cpp index e96e83f65..f66d99e28 100644 --- a/src/providers/seventv/SeventvEmotes.cpp +++ b/src/providers/seventv/SeventvEmotes.cpp @@ -432,7 +432,7 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData) auto baseUrl = host["url"].toString(); auto files = host["files"].toArray(); - std::array sizes; + std::array sizes; double baseWidth = 0.0; size_t nextSize = 0; @@ -486,7 +486,18 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData) } } - return ImageSet{sizes[0], sizes[1], sizes[2]}; + // Typically, 7TV provides four versions (1x, 2x, 3x, and 4x). The 3x + // version has a scale factor of 1/3, which is a size other providers don't + // provide - they only provide the 4x version (0.25). To be in line with + // other providers, we prefer the 4x version but fall back to the 3x one if + // it doesn't exist. + auto largest = std::move(sizes[3]); + if (!largest || largest->isEmpty()) + { + largest = std::move(sizes[2]); + } + + return ImageSet{sizes[0], sizes[1], largest}; } } // namespace chatterino