Merge remote-tracking branch 'upstream/master' into new-master

This commit is contained in:
Eric Kotato 2020-02-26 02:22:04 +03:00
commit eacf588546
4 changed files with 8 additions and 23 deletions

View file

@ -37,13 +37,6 @@ constexpr auto kMaxId = uint32(1 << 8);
constexpr auto kScaleForTouchBar = 150;
const auto kSets = {
Set{ 0, 0, 0, "Mac", ":/gui/emoji/set0_preview.webp" },
Set{ 1, 246, 7'336'383, "Android", ":/gui/emoji/set1_preview.webp" },
Set{ 2, 206, 5'038'738, "Twemoji", ":/gui/emoji/set2_preview.webp" },
Set{ 3, 238, 6'992'260, "JoyPixels", ":/gui/emoji/set3_preview.webp" },
};
// Right now we can't allow users of Ui::Emoji to create custom sizes.
// Any Instance::Instance() can invalidate Universal.id() and sprites.
// So all Instance::Instance() should happen before async generations.
@ -527,10 +520,6 @@ void ClearIrrelevantCache() {
});
}
std::vector<Set> Sets() {
return kSets | ranges::to_vector;
}
int CurrentSetId() {
Expects(Universal != nullptr);

View file

@ -29,18 +29,9 @@ void Clear();
void ClearIrrelevantCache();
struct Set {
int id = 0;
int postId = 0;
int size = 0;
QString name;
QString previewPath;
};
// Thread safe, callback is called on main thread.
void SwitchToSet(int id, Fn<void(bool)> callback);
std::vector<Set> Sets();
int CurrentSetId();
bool SetIsReady(int id);
rpl::producer<> Updated();

View file

@ -463,12 +463,17 @@ void prepareRound(
if (imageWidth < 2 * cornerWidth || imageHeight < 2 * cornerHeight) {
return;
}
// We need to detach image first (if it is shared), before we
// count some offsets using QImage::bytesPerLine etc, because
// bytesPerLine may change on detach, this leads to crashes:
// Real image bytesPerLine is smaller than the one we use for offsets.
auto ints = reinterpret_cast<uint32*>(image.bits());
constexpr auto imageIntsPerPixel = 1;
auto imageIntsPerLine = (image.bytesPerLine() >> 2);
Assert(image.depth() == static_cast<int>((imageIntsPerPixel * sizeof(uint32)) << 3));
Assert(image.bytesPerLine() == (imageIntsPerLine << 2));
auto ints = reinterpret_cast<uint32*>(image.bits());
auto intsTopLeft = ints + target.x() + target.y() * imageIntsPerLine;
auto intsTopRight = ints + target.x() + target.width() - cornerWidth + target.y() * imageIntsPerLine;
auto intsBottomLeft = ints + target.x() + (target.y() + target.height() - cornerHeight) * imageIntsPerLine;

View file

@ -153,7 +153,7 @@ public:
}
Icon(const Icon &other) : _data(other._data) {
}
Icon(Icon &&other) : _data(base::take(other._data)), _owner(base::take(_owner)) {
Icon(Icon &&other) : _data(base::take(other._data)), _owner(base::take(other._owner)) {
}
Icon &operator=(const Icon &other) {
Expects(!_owner);