Enable skia AA in textboxes
This commit is contained in:
parent
4a0ccc001a
commit
e5394c3830
2 changed files with 4 additions and 1 deletions
|
|
@ -89,13 +89,14 @@ void TextBoxCanvasComponent::draw(SkCanvas* canvas, const DrawData& drawData, co
|
||||||
p.setColor4f({0.5f, 0.5f, 0.5f, 1.0f});
|
p.setColor4f({0.5f, 0.5f, 0.5f, 1.0f});
|
||||||
canvas->drawRect(clipR, p);
|
canvas->drawRect(clipR, p);
|
||||||
}
|
}
|
||||||
canvas->clipRect(clipR);
|
canvas->clipRect(clipR, drawData.skiaAA);
|
||||||
canvas->translate(d.p1.x() + TEXTBOX_PADDING, d.p1.y() + TEXTBOX_PADDING);
|
canvas->translate(d.p1.x() + TEXTBOX_PADDING, d.p1.y() + TEXTBOX_PADDING);
|
||||||
|
|
||||||
TextBox::PaintOpts paintOpts;
|
TextBox::PaintOpts paintOpts;
|
||||||
paintOpts.cursorColor = {0.7f, 0.7f, 1.0f};
|
paintOpts.cursorColor = {0.7f, 0.7f, 1.0f};
|
||||||
if(d.editing && cursor)
|
if(d.editing && cursor)
|
||||||
paintOpts.cursor = *cursor;
|
paintOpts.cursor = *cursor;
|
||||||
|
paintOpts.skiaAA = drawData.skiaAA;
|
||||||
|
|
||||||
textBox->paint(canvas, paintOpts);
|
textBox->paint(canvas, paintOpts);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ template <typename T> class TextBox : public Element {
|
||||||
SkPaint outline(selection.selected ? io.theme->fillColor1 : io.theme->backColor2);
|
SkPaint outline(selection.selected ? io.theme->fillColor1 : io.theme->backColor2);
|
||||||
outline.setStroke(true);
|
outline.setStroke(true);
|
||||||
outline.setStrokeWidth(2.0f);
|
outline.setStrokeWidth(2.0f);
|
||||||
|
outline.setAntiAlias(skiaAA);
|
||||||
canvas->drawRoundRect(r, 2.0f, 2.0f, outline);
|
canvas->drawRoundRect(r, 2.0f, 2.0f, outline);
|
||||||
|
|
||||||
canvas->clipRect(SkRect::MakeXYWH(bb.min.x(), bb.min.y(), bb.width(), bb.height()));
|
canvas->clipRect(SkRect::MakeXYWH(bb.min.x(), bb.min.y(), bb.width(), bb.height()));
|
||||||
|
|
@ -90,6 +91,7 @@ template <typename T> class TextBox : public Element {
|
||||||
else
|
else
|
||||||
canvas->translate(bb.min.x() + 2.0f, bb.min.y() + yOffset);
|
canvas->translate(bb.min.x() + 2.0f, bb.min.y() + yOffset);
|
||||||
paintOpts.cursorColor = {io.theme->fillColor1.fR, io.theme->fillColor1.fG, io.theme->fillColor1.fB};
|
paintOpts.cursorColor = {io.theme->fillColor1.fR, io.theme->fillColor1.fG, io.theme->fillColor1.fB};
|
||||||
|
paintOpts.skiaAA = skiaAA;
|
||||||
|
|
||||||
skia::textlayout::TextStyle tStyle;
|
skia::textlayout::TextStyle tStyle;
|
||||||
tStyle.setFontFamilies(io.fonts->get_default_font_families());
|
tStyle.setFontFamilies(io.fonts->get_default_font_families());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue