diff --git a/ui/style/style_core_icon.h b/ui/style/style_core_icon.h index 6cfa3ff6..30c2ae33 100644 --- a/ui/style/style_core_icon.h +++ b/ui/style/style_core_icon.h @@ -234,6 +234,13 @@ class Icon { outer.y() + (outer.height() - height()) / 2), outer.x() * 2 + outer.width()); } + void paintInCenter(QPainter &p, const QRectF &outer) const { + const auto dx = outer.x() + (outer.width() - width()) / 2.; + const auto dy = outer.y() + (outer.height() - height()) / 2.; + p.translate(dx, dy); + _data->paint(p, QPoint(), outer.x() * 2. + outer.width()); + p.translate(-dx, -dy); + } void fill(QPainter &p, const QRect &rect) const { return _data->fill(p, rect); } @@ -265,6 +272,16 @@ class Icon { outer.x() * 2 + outer.width(), colorOverride); } + void paintInCenter( + QPainter &p, + const QRectF &outer, + QColor override) const { + const auto dx = outer.x() + (outer.width() - width()) / 2; + const auto dy = outer.y() + (outer.height() - height()) / 2; + p.translate(dx, dy); + _data->paint(p, QPoint(), outer.x() * 2 + outer.width(), override); + p.translate(-dx, -dy); + } void fill(QPainter &p, const QRect &rect, QColor colorOverride) const { return _data->fill(p, rect, colorOverride); }