tdesktop/Telegram/SourceFiles/storage/serialize_common.cpp

30 lines
770 B
C++
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
2017-03-04 10:23:56 +00:00
#include "storage/serialize_common.h"
namespace Serialize {
2019-08-23 13:52:59 +00:00
void writeColor(QDataStream &stream, const QColor &color) {
stream << (quint32(uchar(color.red()))
| (quint32(uchar(color.green())) << 8)
| (quint32(uchar(color.blue())) << 16)
| (quint32(uchar(color.alpha())) << 24));
}
QColor readColor(QDataStream &stream) {
auto value = quint32();
stream >> value;
return QColor(
int(value & 0xFFU),
int((value >> 8) & 0xFFU),
int((value >> 16) & 0xFFU),
int((value >> 24) & 0xFFU));
}
} // namespace Serialize