MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / paint

Method paint

src/RichText/TextBox.cpp:1334–1355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334void TextBox::paint(SkCanvas* canvas, const PaintOpts& paintOpts) {
1335 rebuild();
1336
1337 for(auto& pData : paragraphs)
1338 pData.p->paint(canvas, 0.0f, pData.heightOffset);
1339
1340 if(paintOpts.cursor.has_value()) {
1341 auto& cur = paintOpts.cursor.value();
1342 SkPaint selectionP{SkColor4f{paintOpts.cursorColor.x(), paintOpts.cursorColor.y(), paintOpts.cursorColor.z(), 1.0f}};
1343 selectionP.setAntiAlias(paintOpts.skiaAA);
1344 if(cur.selectionBeginPos != cur.selectionEndPos) {
1345 canvas->saveLayerAlphaf(nullptr, 0.5f);
1346 rects_between_text_positions_func(cur.selectionBeginPos, cur.selectionEndPos, [&](const SkRect& rect) {
1347 canvas->drawRect(rect, selectionP);
1348 });
1349 canvas->restore();
1350 }
1351 SkPaint cursorP{SkColor4f{paintOpts.cursorColor.x(), paintOpts.cursorColor.y(), paintOpts.cursorColor.z(), 1.0f}};
1352 cursorP.setAntiAlias(paintOpts.skiaAA);
1353 canvas->drawRect(get_cursor_rect(cur.pos), cursorP);
1354 }
1355}
1356
1357}

Callers 6

draw_cursorMethod · 0.80
drawMethod · 0.80
drawMethod · 0.80
draw_forceMethod · 0.80
clay_drawMethod · 0.80
clay_drawMethod · 0.80

Calls 5

restoreMethod · 0.80
valueMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected