mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Paint all backgrounds first to prevent overlap (flutter/engine#7287)
This commit is contained in:
parent
deff80f12e
commit
bfbb7a080b
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user