未验证 提交 54d7c425 编写于 作者: G Gary Qian 提交者: GitHub

Paint all backgrounds first to prevent overlap (#7287)

上级 0ad16dd1
......@@ -923,6 +923,11 @@ sk_sp<SkTypeface> Paragraph::GetDefaultSkiaTypeface(const TextStyle& style) {
void Paragraph::Paint(SkCanvas* canvas, double x, double y) {
SkPoint base_offset = SkPoint::Make(x, y);
SkPaint paint;
// Paint the background first before painting any text to prevent
// potential overlap.
for (const PaintRecord& record : records_) {
PaintBackground(canvas, record, base_offset);
}
for (const PaintRecord& record : records_) {
if (record.style().has_foreground) {
paint = record.style().foreground;
......@@ -931,7 +936,6 @@ void Paragraph::Paint(SkCanvas* canvas, double x, double y) {
paint.setColor(record.style().color);
}
SkPoint offset = base_offset + record.offset();
PaintBackground(canvas, record, base_offset);
PaintShadow(canvas, record, offset);
canvas->drawTextBlob(record.text(), offset.x(), offset.y(), paint);
PaintDecorations(canvas, record, base_offset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册