diff options
author | Neil <nyamatongwe@gmail.com> | 2015-09-23 09:33:21 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2015-09-23 09:33:21 +1000 |
commit | a1104a01eb27a3ca87b1d04d75189c5ee40c7651 (patch) | |
tree | 2beb0d1376d40c574a568b8ebd49c9aa142925fb /src/ViewStyle.cxx | |
parent | 7d38203480abda0f0a8a73f1c374ff91e38dda14 (diff) | |
download | scintilla-mirror-a1104a01eb27a3ca87b1d04d75189c5ee40c7651.tar.gz |
When SC_MARK_UNDERLINE if not assigned to a margin, stop drawing the whole line.
Optimise drawing of markers that appear in the text area.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 7ece73b2e..e8bf51363 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -151,6 +151,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { ms[margin] = source.ms[margin]; } maskInLine = source.maskInLine; + maskDrawInText = source.maskDrawInText; fixedColumnWidth = source.fixedColumnWidth; marginInside = source.marginInside; textStart = source.textStart; @@ -191,6 +192,32 @@ ViewStyle::~ViewStyle() { fonts.clear(); } +void ViewStyle::CalculateMarginWidthAndMask() { + fixedColumnWidth = marginInside ? leftMarginWidth : 0; + maskInLine = 0xffffffff; + int maskDefinedMarkers = 0; + for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { + fixedColumnWidth += ms[margin].width; + if (ms[margin].width > 0) + maskInLine &= ~ms[margin].mask; + maskDefinedMarkers |= ms[margin].mask; + } + maskDrawInText = 0; + for (int markBit = 0; markBit < 32; markBit++) { + const int maskBit = 1 << markBit; + switch (markers[markBit].markType) { + case SC_MARK_EMPTY: + maskInLine &= ~maskBit; + break; + case SC_MARK_BACKGROUND: + case SC_MARK_UNDERLINE: + maskInLine &= ~maskBit; + maskDrawInText |= maskDefinedMarkers & maskBit; + break; + } + } +} + void ViewStyle::Init(size_t stylesSize_) { AllocStyles(stylesSize_); nextExtendedStyle = 256; @@ -265,13 +292,7 @@ void ViewStyle::Init(size_t stylesSize_) { ms[2].width = 0; ms[2].mask = 0; marginInside = true; - fixedColumnWidth = marginInside ? leftMarginWidth : 0; - maskInLine = 0xffffffff; - for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { - fixedColumnWidth += ms[margin].width; - if (ms[margin].width > 0) - maskInLine &= ~ms[margin].mask; - } + CalculateMarginWidthAndMask(); textStart = marginInside ? fixedColumnWidth : leftMarginWidth; zoomLevel = 0; viewWhitespace = wsInvisible; @@ -368,13 +389,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast<char>(controlCharSymbol)); } - fixedColumnWidth = marginInside ? leftMarginWidth : 0; - maskInLine = 0xffffffff; - for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { - fixedColumnWidth += ms[margin].width; - if (ms[margin].width > 0) - maskInLine &= ~ms[margin].mask; - } + CalculateMarginWidthAndMask(); textStart = marginInside ? fixedColumnWidth : leftMarginWidth; } @@ -477,7 +492,7 @@ ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lin int marksMasked = marksOfLine & maskInLine; if (marksMasked) { for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { - if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) && + if ((marksMasked & 1) && (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { background = ColourOptional(markers[markBit].back, true); } |