summaryrefslogtreecommitdiffstats
path: root/scintilla/src
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2012-08-16 18:56:32 +0000
committerXhmikosR <xhmikosr@users.sourceforge.net>2012-08-16 18:56:32 +0000
commitb21d755414af09593096ded90b9cf987bebab3d5 (patch)
tree3f8f8ad83c8c3f3ef009402709ea6b4b76a5c9f1 /scintilla/src
parent790954f47a1c249ef073fad87e5fa84226413fee (diff)
downloadnotepad2-mod-b21d755414af09593096ded90b9cf987bebab3d5.zip
notepad2-mod-b21d755414af09593096ded90b9cf987bebab3d5.tar.gz
notepad2-mod-b21d755414af09593096ded90b9cf987bebab3d5.tar.bz2
update scintilla (HG 407e41242bf1)
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@757 28bd50df-7adb-d945-0439-6e466c6a13cc
Diffstat (limited to 'scintilla/src')
-rw-r--r--scintilla/src/Indicator.cxx49
1 files changed, 39 insertions, 10 deletions
diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx
index 97e1c02..20e7f6e 100644
--- a/scintilla/src/Indicator.cxx
+++ b/scintilla/src/Indicator.cxx
@@ -18,19 +18,49 @@
using namespace Scintilla;
#endif
+static PRectangle PixelGridAlign(const PRectangle &rc) {
+ // Move left and right side to nearest pixel to avoid blurry visuals
+ return PRectangle(int(rc.left + 0.5), rc.top, int(rc.right + 0.5), rc.bottom);
+}
+
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
surface->PenColour(fore);
int ymid = (rc.bottom + rc.top) / 2;
if (style == INDIC_SQUIGGLE) {
- surface->MoveTo(rc.left, rc.top);
- int x = rc.left + 2;
- int y = 2;
- while (x < rc.right) {
+ int x = int(rc.left+0.5);
+ int xLast = int(rc.right+0.5);
+ int y = 0;
+ surface->MoveTo(x, rc.top + y);
+ while (x < xLast) {
+ if ((x + 2) > xLast) {
+ if (xLast > x)
+ y = 1;
+ x = xLast;
+ } else {
+ x += 2;
+ y = 2 - y;
+ }
surface->LineTo(x, rc.top + y);
- x += 2;
- y = 2 - y;
}
- surface->LineTo(rc.right, rc.top + y); // Finish the line
+ } else if (style == INDIC_SQUIGGLEPIXMAP) {
+ PRectangle rcSquiggle = PixelGridAlign(rc);
+
+ int width = Platform::Minimum(4000, rcSquiggle.Width());
+ RGBAImage image(width, 3, 1.0, 0);
+ enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
+ for (int x = 0; x < width; x++) {
+ if (x%2) {
+ // Two halfway columns have a full pixel in middle flanked by light pixels
+ image.SetPixel(x, 0, fore, alphaSide);
+ image.SetPixel(x, 1, fore, alphaFull);
+ image.SetPixel(x, 2, fore, alphaSide);
+ } else {
+ // Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre
+ image.SetPixel(x, (x%4) ? 0 : 2, fore, alphaFull);
+ image.SetPixel(x, 1, fore, alphaSide2);
+ }
+ }
+ surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
} else if (style == INDIC_SQUIGGLELOW) {
surface->MoveTo(rc.left, rc.top);
int x = rc.left + 3;
@@ -89,10 +119,9 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0);
} else if (style == INDIC_DOTBOX) {
- PRectangle rcBox = rcLine;
+ PRectangle rcBox = PixelGridAlign(rc);
rcBox.top = rcLine.top + 1;
- rcBox.left = rc.left;
- rcBox.right = rc.right;
+ rcBox.bottom = rcLine.bottom;
// Cap width at 4000 to avoid large allocations when mistakes made
int width = Platform::Minimum(rcBox.Width(), 4000);
RGBAImage image(width, rcBox.Height(), 1.0, 0);