Skip to content

Commit

Permalink
feat: use 4x images on 7TV instead of 3x (#5209)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz authored Feb 26, 2024
1 parent 4315c43 commit 5f6261c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 13 additions & 2 deletions src/providers/seventv/SeventvEmotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
auto baseUrl = host["url"].toString();
auto files = host["files"].toArray();

std::array<ImagePtr, 3> sizes;
std::array<ImagePtr, 4> sizes;
double baseWidth = 0.0;
size_t nextSize = 0;

Expand Down Expand Up @@ -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

0 comments on commit 5f6261c

Please sign in to comment.