Added None and Skia antialiasing options in debug menu

This commit is contained in:
Yousef Khadadeh 2026-03-20 20:53:59 +03:00
parent 30fdec05c1
commit d973bde4be
50 changed files with 177 additions and 93 deletions

View file

@ -1249,6 +1249,7 @@ void TextBox::paint(SkCanvas* canvas, const PaintOpts& paintOpts) {
if(paintOpts.cursor.has_value()) {
auto& cur = paintOpts.cursor.value();
SkPaint selectionP{SkColor4f{paintOpts.cursorColor.x(), paintOpts.cursorColor.y(), paintOpts.cursorColor.z(), 1.0f}};
selectionP.setAntiAlias(paintOpts.skiaAA);
if(cur.selectionBeginPos != cur.selectionEndPos) {
canvas->saveLayerAlphaf(nullptr, 0.5f);
rects_between_text_positions_func(cur.selectionBeginPos, cur.selectionEndPos, [&](const SkRect& rect) {
@ -1257,6 +1258,7 @@ void TextBox::paint(SkCanvas* canvas, const PaintOpts& paintOpts) {
canvas->restore();
}
SkPaint cursorP{SkColor4f{paintOpts.cursorColor.x(), paintOpts.cursorColor.y(), paintOpts.cursorColor.z(), 1.0f}};
cursorP.setAntiAlias(paintOpts.skiaAA);
canvas->drawRect(get_cursor_rect(cur.pos), cursorP);
}
}

View file

@ -98,6 +98,7 @@ class TextBox {
struct PaintOpts {
Vector3f cursorColor = {1, 0, 0};
std::optional<Cursor> cursor;
bool skiaAA = false;
};
TextPosition move(Movement movement, TextPosition pos, std::optional<float>* previousX = nullptr, bool flipDependingOnTextDirection = false);