未验证 提交 5309ac6c 编写于 作者: B Brian Osman 提交者: GitHub

Remove SkToBool usage (#4429)

上级 8e397601
......@@ -763,8 +763,8 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
}
paint.setStrokeWidth(
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlineThicknessIsValid_Flag))
(metrics.fFlags &
SkPaint::FontMetrics::FontMetricsFlags::kUnderlineThicknessIsValid_Flag)
? metrics.fUnderlineThickness *
record.style().decoration_thickness_multiplier
// Backup value if the fUnderlineThickness metric is not available:
......@@ -833,11 +833,10 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
double y_offset_original = y_offset;
// Underline
if (record.style().decoration & 0x1) {
y_offset +=
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlinePositionIsValid_Flag))
? metrics.fUnderlinePosition
: metrics.fUnderlineThickness;
y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlinePositionIsValid_Flag)
? metrics.fUnderlinePosition
: metrics.fUnderlineThickness;
if (record.style().decoration_style != TextDecorationStyle::kWavy) {
canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint);
} else {
......@@ -863,20 +862,19 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
}
// Strikethrough
if (record.style().decoration & 0x4) {
if (SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag))
if (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag)
paint.setStrokeWidth(metrics.fStrikeoutThickness *
record.style().decoration_thickness_multiplier);
// Make sure the double line is "centered" vertically.
y_offset += (decoration_count - 1.0) * metrics.fUnderlineThickness *
kDoubleDecorationSpacing / -2.0;
y_offset +=
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag))
? metrics.fStrikeoutPosition
// Backup value if the strikeoutposition metric is not
// available:
: metrics.fXHeight / -2.0;
y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag)
? metrics.fStrikeoutPosition
// Backup value if the strikeoutposition metric is not
// available:
: metrics.fXHeight / -2.0;
if (record.style().decoration_style != TextDecorationStyle::kWavy) {
canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册