MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / init

Method init

Telegram/SourceFiles/settings/settings_scale_preview.cpp:269–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void Preview::init() {
270 const auto background = Window::Theme::Background();
271 const auto &paper = background->paper();
272 _theme.setBackground({
273 .prepared = background->prepared(),
274 .preparedForTiled = background->preparedForTiled(),
275 .gradientForFill = background->gradientForFill(),
276 .colorForFill = background->colorForFill(),
277 .colors = paper.backgroundColors(),
278 .patternOpacity = paper.patternOpacity(),
279 .gradientRotation = paper.gradientRotation(),
280 .isPattern = paper.isPattern(),
281 .tile = background->tile(),
282 });
283
284 _widget.paintRequest(
285 ) | rpl::on_next([=](QRect clip) {
286 auto p = Painter(&_widget);
287 paint(p, clip);
288 }, _widget.lifetime());
289
290 style::PaletteChanged(
291 ) | rpl::on_next([=] {
292 _bubbleCorners = {};
293 _bubbleTail = {};
294 _bubbleShadowBottomRight = {};
295 update();
296 }, _widget.lifetime());
297
298 if (_window) {
299 initAsWindow();
300 updateToScale(style::kScaleMin);
301 _minOuterSize = _outer.size();
302 updateToScale(style::MaxScaleForRatio(_ratio));
303 _maxOuterSize = _outer.size();
304 }
305}
306
307int Preview::scaled(int value) const {
308 return style::ConvertScale(value, _scale);

Callers 1

ChartMethod · 0.45

Calls 13

PaletteChangedFunction · 0.85
paperMethod · 0.80
setBackgroundMethod · 0.80
backgroundColorsMethod · 0.80
patternOpacityMethod · 0.80
gradientRotationMethod · 0.80
isPatternMethod · 0.80
tileMethod · 0.80
BackgroundFunction · 0.50
PainterClass · 0.50
updateFunction · 0.50
preparedMethod · 0.45

Tested by

no test coverage detected