feat: use 4x images on 7TV instead of 3x (#5209)

This commit is contained in:
nerix 2024-02-26 19:38:30 +01:00 committed by GitHub
parent 4315c43eac
commit 5f6261c0cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View file

@ -40,6 +40,7 @@
- Minor: Allow theming of tab live and rerun indicators. (#5188) - 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: 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: 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 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: 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) - 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)

View file

@ -432,7 +432,7 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
auto baseUrl = host["url"].toString(); auto baseUrl = host["url"].toString();
auto files = host["files"].toArray(); auto files = host["files"].toArray();
std::array<ImagePtr, 3> sizes; std::array<ImagePtr, 4> sizes;
double baseWidth = 0.0; double baseWidth = 0.0;
size_t nextSize = 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 } // namespace chatterino