2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

New style::icon class added, colorized icons by codegen_style.

Moved style_core to /ui/style/, Xcode and QtCreator builds are broken.
This commit is contained in:
John Preston
2016-04-21 20:57:29 +03:00
parent a133115aa6
commit 705358993d
97 changed files with 2090 additions and 1548 deletions

View File

@@ -129,22 +129,7 @@ void createCircleMask(int size) {
}
QImage colorizeCircleHalf(int size, int half, int xoffset, style::color color) {
int a = color->c.alpha() + 1;
int fg_r = color->c.red() * a, fg_g = color->c.green() * a, fg_b = color->c.blue() * a, fg_a = 255 * a;
QImage result(half, size, QImage::Format_ARGB32_Premultiplied);
uchar *bits = result.bits(), *maskbits = unreadBadgeStyle->circle.bits();
int bpl = result.bytesPerLine(), maskbpl = unreadBadgeStyle->circle.bytesPerLine();
for (int x = 0; x < half; ++x) {
for (int y = 0; y < size; ++y) {
int s = y * bpl + (x * 4);
int o = maskbits[y * maskbpl + x + xoffset] + 1;
bits[s + 0] = (fg_b * o) >> 16;
bits[s + 1] = (fg_g * o) >> 16;
bits[s + 2] = (fg_r * o) >> 16;
bits[s + 3] = (fg_a * o) >> 16;
}
}
auto result = style::colorizeImage(unreadBadgeStyle->circle, color, QRect(xoffset, 0, half, size));
result.setDevicePixelRatio(cRetinaFactor());
return result;
}