mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Allow using any interface scale between 100%-300%.
This commit is contained in:
@@ -1123,20 +1123,12 @@ bool Generator::writePxValuesInit() {
|
||||
void initPxValues() {\n\
|
||||
if (cRetina()) return;\n\
|
||||
\n\
|
||||
switch (cScale()) {\n";
|
||||
for (int i = 1, scalesCount = _scales.size(); i < scalesCount; ++i) {
|
||||
source_->stream() << "\tcase " << _scaleNames.at(i) << ":\n";
|
||||
for (auto it = pxValues_.cbegin(), e = pxValues_.cend(); it != e; ++it) {
|
||||
auto value = it.key();
|
||||
int adjusted = structure::data::pxAdjust(value, _scales.at(i));
|
||||
if (adjusted != value) {
|
||||
source_->stream() << "\t\t" << pxValueName(value) << " = " << adjusted << ";\n";
|
||||
}
|
||||
}
|
||||
source_->stream() << "\tbreak;\n";
|
||||
const auto scale = cScale();\n";
|
||||
for (auto it = pxValues_.cbegin(), e = pxValues_.cend(); it != e; ++it) {
|
||||
auto value = it.key();
|
||||
source_->stream() << "\t" << pxValueName(value) << " = ConvertScale(" << value << ", scale);\n";
|
||||
}
|
||||
source_->stream() << "\
|
||||
}\n\
|
||||
}\n\n";
|
||||
return true;
|
||||
}
|
||||
|
@@ -64,9 +64,6 @@ private:
|
||||
QMap<QString, int> iconMasks_; // icon file -> index
|
||||
std::map<QString, int, std::greater<QString>> paletteIndices_;
|
||||
|
||||
std::vector<int> _scales = { 4, 5, 6, 8 }; // scale / 4 gives our 1.00, 1.25, 1.50, 2.00
|
||||
std::vector<const char *> _scaleNames = { "dbisOne", "dbisOneAndQuarter", "dbisOneAndHalf", "dbisTwo" };
|
||||
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
@@ -59,13 +59,6 @@ inline bool operator!=(const Type &a, const Type &b) {
|
||||
|
||||
namespace data {
|
||||
|
||||
inline int pxAdjust(int value, int scale) {
|
||||
if (value < 0) {
|
||||
return -pxAdjust(-value, scale);
|
||||
}
|
||||
return qFloor((value * scale / 4.) + 0.1);
|
||||
}
|
||||
|
||||
struct point {
|
||||
int x, y;
|
||||
};
|
||||
|
Reference in New Issue
Block a user