mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-06-02 03:53:42 +02:00
Optimize sub/super/mark additions.
This commit is contained in:
@@ -1875,6 +1875,7 @@ MarkdownStyleSnapshot CaptureMarkdownStyleSnapshot() {
|
||||
result.textPalette = {
|
||||
.link = Resolve(st::ivMarkdownTextPalette.linkFg),
|
||||
.mono = Resolve(st::ivMarkdownTextPalette.monoFg),
|
||||
.mark = Resolve(st::ivMarkdownTextPalette.markBg),
|
||||
.spoiler = Resolve(st::ivMarkdownTextPalette.spoilerFg),
|
||||
.selectBackground = Resolve(st::ivMarkdownTextPalette.selectBg),
|
||||
.selectText = Resolve(st::ivMarkdownTextPalette.selectFg),
|
||||
|
||||
@@ -102,6 +102,7 @@ using PrepareGeneration = uint64;
|
||||
struct MarkdownTextPaletteSnapshot {
|
||||
QColor link;
|
||||
QColor mono;
|
||||
QColor mark;
|
||||
QColor spoiler;
|
||||
QColor selectBackground;
|
||||
QColor selectText;
|
||||
|
||||
@@ -63,6 +63,7 @@ struct SnapshotTextPalette {
|
||||
explicit SnapshotTextPalette(const MarkdownTextPaletteSnapshot &snapshot)
|
||||
: link(snapshot.link)
|
||||
, mono(snapshot.mono)
|
||||
, mark(snapshot.mark)
|
||||
, spoiler(snapshot.spoiler)
|
||||
, selectBackground(snapshot.selectBackground)
|
||||
, selectText(snapshot.selectText)
|
||||
@@ -72,6 +73,7 @@ struct SnapshotTextPalette {
|
||||
, selectOverlay(snapshot.selectOverlay) {
|
||||
palette.linkFg = link.color();
|
||||
palette.monoFg = mono.color();
|
||||
palette.markBg = mark.color();
|
||||
palette.spoilerFg = spoiler.color();
|
||||
palette.selectBg = selectBackground.color();
|
||||
palette.selectFg = selectText.color();
|
||||
@@ -84,6 +86,7 @@ struct SnapshotTextPalette {
|
||||
|
||||
style::owned_color link;
|
||||
style::owned_color mono;
|
||||
style::owned_color mark;
|
||||
style::owned_color spoiler;
|
||||
style::owned_color selectBackground;
|
||||
style::owned_color selectText;
|
||||
@@ -759,17 +762,6 @@ struct InlineFormulaMetrics {
|
||||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]] Ui::Text::InlineHtmlMetrics InlineHtmlMetricsFor(
|
||||
const MarkdownStyleSnapshot &style) {
|
||||
return {
|
||||
.subscriptScale = style.subscriptScale,
|
||||
.superscriptScale = style.superscriptScale,
|
||||
.subscriptBaselineOffset = style.subscriptBaselineOffset,
|
||||
.superscriptBaselineOffset = style.superscriptBaselineOffset,
|
||||
.markBackgroundColor = style.markBackgroundColor,
|
||||
};
|
||||
}
|
||||
|
||||
void SetTextLeaf(
|
||||
Ui::Text::String *leaf,
|
||||
const style::TextStyle &textStyle,
|
||||
@@ -782,7 +774,6 @@ void SetTextLeaf(
|
||||
context.inlineObjects = Ui::Text::InlineObjectPlacements(
|
||||
placements.data(),
|
||||
placements.size());
|
||||
context.other = InlineHtmlMetricsFor(style);
|
||||
leaf->setMarkedText(textStyle, text, kIvMarkedTextOptions, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ QImage Sibling::nameImage(const SiblingLayout &layout) {
|
||||
const auto family = 0; // Default font family.
|
||||
const auto font = style::font(
|
||||
_nameFontSize,
|
||||
style::FontFlag::Semibold,
|
||||
style::FontFlag::Bold,
|
||||
family);
|
||||
_name.reset();
|
||||
_nameStyle = std::make_unique<style::TextStyle>(style::TextStyle{
|
||||
|
||||
@@ -583,7 +583,7 @@ PreviewPainter::PreviewPainter(const QImage &bg, PreviewRequest request)
|
||||
: _request(request)
|
||||
, _msgBg(_request.msgBg)
|
||||
, _msgShadow(_request.msgShadow)
|
||||
, _nameFontOwned(_request.family, style::FontFlag::Semibold, st::fsize)
|
||||
, _nameFontOwned(_request.family, style::FontFlag::Bold, st::fsize)
|
||||
, _nameFont(_nameFontOwned.font())
|
||||
, _nameStyle(st::semiboldTextStyle)
|
||||
, _textFontOwned(_request.family, 0, st::fsize)
|
||||
|
||||
@@ -80,7 +80,7 @@ PaintRoundImageCallback MultiThumbnail(
|
||||
q.setBrush(st::shadowFg);
|
||||
q.drawRoundedRect(QRect(0, shift, smaller, smaller), radius, radius);
|
||||
q.setPen(st::toastFg);
|
||||
q.setFont(style::font(smaller / 2, style::FontFlag::Semibold, 0));
|
||||
q.setFont(style::font(smaller / 2, style::FontFlag::Bold, 0));
|
||||
q.drawText(
|
||||
QRect(0, shift, smaller, smaller),
|
||||
QString::number(totalCount),
|
||||
|
||||
+1
-1
Submodule Telegram/codegen updated: bed44322dc...47a93f77d3
Reference in New Issue
Block a user