Default decoration color to text color.

Change-Id: I74f1ffc6372ccf952232e9dcbba66029c31a7088
This commit is contained in:
Gary Qian
2017-07-26 15:18:50 -07:00
parent d447e4de83
commit 476860da54
2 changed files with 8 additions and 2 deletions

View File

@@ -622,7 +622,11 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
const SkPaint::FontMetrics& metrics = record.metrics();
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(record.style().decoration_color);
if (record.style().decoration_color == SK_ColorTRANSPARENT) {
paint.setColor(record.style().color);
} else {
paint.setColor(record.style().decoration_color);
}
paint.setAntiAlias(true);
// This is set to 2 for the double line style

View File

@@ -31,7 +31,9 @@ class TextStyle {
public:
SkColor color = SK_ColorBLACK;
TextDecoration decoration = TextDecoration::kNone;
SkColor decoration_color = SK_ColorBLACK;
// Does not make sense to draw a transparent object, so we use it as a default
// value to indicate no decoration color was set.
SkColor decoration_color = SK_ColorTRANSPARENT;
TextDecorationStyle decoration_style = TextDecorationStyle::kSolid;
double decoration_thickness = 1.0;
FontWeight font_weight = FontWeight::w400;