MCPcopy Create free account
hub / github.com/cxasm/notepad-- / PaintText

Method PaintText

src/qscint/scintilla/src/EditView.cpp:1995–2182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1993}
1994
1995void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea,
1996 PRectangle rcClient, const ViewStyle &vsDraw) {
1997 // Allow text at start of line to overlap 1 pixel into the margin as this displays
1998 // serifs and italic stems for aliased text.
1999 const int leftTextOverlap = ((model.xOffset == 0) && (vsDraw.leftMarginWidth > 0)) ? 1 : 0;
2000
2001 // Do the painting
2002 if (rcArea.right > vsDraw.textStart - leftTextOverlap) {
2003
2004 Surface *surface = surfaceWindow;
2005 if (bufferedDraw) {
2006 surface = pixmapLine.get();
2007 PLATFORM_ASSERT(pixmapLine->Initialised());
2008 }
2009 surface->SetUnicodeMode(SC_CP_UTF8 == model.pdoc->dbcsCodePage);
2010 surface->SetDBCSMode(model.pdoc->dbcsCodePage);
2011
2012 const Point ptOrigin = model.GetVisibleOriginInMain();
2013
2014 const int screenLinePaintFirst = static_cast<int>(rcArea.top) / vsDraw.lineHeight;
2015 const int xStart = vsDraw.textStart - model.xOffset + static_cast<int>(ptOrigin.x);
2016
2017 SelectionPosition posCaret = model.sel.RangeMain().caret;
2018 if (model.posDrag.IsValid())
2019 posCaret = model.posDrag;
2020 const Sci::Line lineCaret = model.pdoc->SciLineFromPosition(posCaret.Position());
2021
2022 PRectangle rcTextArea = rcClient;
2023 if (vsDraw.marginInside) {
2024 rcTextArea.left += vsDraw.textStart;
2025 rcTextArea.right -= vsDraw.rightMarginWidth;
2026 } else {
2027 rcTextArea = rcArea;
2028 }
2029
2030 // Remove selection margin from drawing area so text will not be drawn
2031 // on it in unbuffered mode.
2032 if (!bufferedDraw && vsDraw.marginInside) {
2033 PRectangle rcClipText = rcTextArea;
2034 rcClipText.left -= leftTextOverlap;
2035 surfaceWindow->SetClip(rcClipText);
2036 }
2037
2038 // Loop on visible lines
2039#if defined(TIME_PAINTING)
2040 double durLayout = 0.0;
2041 double durPaint = 0.0;
2042 double durCopy = 0.0;
2043 ElapsedPeriod epWhole;
2044#endif
2045 const bool bracesIgnoreStyle = ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) ||
2046 (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD)));
2047
2048 Sci::Line lineDocPrevious = -1; // Used to avoid laying out one document line multiple times
2049 AutoLineLayout ll(llc, nullptr);
2050 std::vector<DrawPhase> phases;
2051 if ((phasesDraw == phasesMultiple) && !bufferedDraw) {
2052 for (DrawPhase phase = drawBack; phase <= drawCarets; phase = static_cast<DrawPhase>(phase * 2)) {

Callers 1

PaintMethod · 0.80

Calls 15

DrawFoldLinesFunction · 0.85
SetUnicodeModeMethod · 0.80
SetDBCSModeMethod · 0.80
SciLineFromPositionMethod · 0.80
PositionMethod · 0.80
SetClipMethod · 0.80
TopLineOfMainMethod · 0.80
LinesDisplayedMethod · 0.80
DocFromDisplayMethod · 0.80
GetVisibleMethod · 0.80
DisplayFromDocMethod · 0.80

Tested by

no test coverage detected