diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-03-02 14:26:08 +0000 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-03-02 14:26:08 +0000 |
commit | 0163a88e50a74af5644fc24ca9b7955179dd4c24 (patch) | |
tree | 6df7031e7ed33f35c374fe2634c0a5a758e90881 | |
parent | 30d007d8a6bd01960f9c700f69449c82b14f3835 (diff) | |
download | notepad2-mod-0163a88e50a74af5644fc24ca9b7955179dd4c24.zip notepad2-mod-0163a88e50a74af5644fc24ca9b7955179dd4c24.tar.gz notepad2-mod-0163a88e50a74af5644fc24ca9b7955179dd4c24.tar.bz2 |
update scintilla
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@716 28bd50df-7adb-d945-0439-6e466c6a13cc
-rw-r--r-- | build/build_wdk.bat | 4 | ||||
-rw-r--r-- | scintilla/lexers/LexCPP.cxx | 2 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 19 | ||||
-rw-r--r-- | scintilla/src/LineMarker.cxx | 10 | ||||
-rw-r--r-- | scintilla/src/Style.h | 2 | ||||
-rw-r--r-- | scintilla/win32/PlatWin.cxx | 44 |
6 files changed, 51 insertions, 30 deletions
diff --git a/build/build_wdk.bat b/build/build_wdk.bat index 54551a2..cbcee83 100644 --- a/build/build_wdk.bat +++ b/build/build_wdk.bat @@ -26,8 +26,8 @@ IF NOT DEFINED VS100COMNTOOLS ( CALL :SUBMSG "INFO" "Visual Studio 2010 wasn't found, I will use WDK's compiler"
SET USE_MSVC2010=
) ELSE (
- rem Comment out the following line or set USE_MSVC2010 to false if you want
- rem to use WDK's compiler instead of MSVC 2010 compiler
+ rem Comment out the following line or set USE_MSVC2010 to anything but true
+ rem if you want to use WDK's compiler instead of MSVC 2010 compiler
SET USE_MSVC2010=true
)
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx index 633cc4d..3b29d21 100644 --- a/scintilla/lexers/LexCPP.cxx +++ b/scintilla/lexers/LexCPP.cxx @@ -676,7 +676,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
}
- sc.SetState(styleBeforeDCKeyword);
+ sc.SetState(styleBeforeDCKeyword|activitySet);
}
break;
case SCE_C_STRING:
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index e900982..185d730 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -1947,8 +1947,8 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { }
PRectangle rcNumber = rcMarker;
// Right justify
- int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
- int xpos = rcNumber.right - width - 3;
+ XYPOSITION width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
+ XYPOSITION xpos = rcNumber.right - width - 3;
rcNumber.left = xpos;
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
rcNumber.top + vs.maxAscent, number, istrlen(number),
@@ -3532,6 +3532,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { }
PLATFORM_ASSERT(pixmapSelPattern->Initialised());
+ if (!bufferedDraw)
+ surfaceWindow->SetClip(rcArea);
+
if (paintState != paintAbandoned) {
PaintSelMargin(surfaceWindow, rcArea);
@@ -3577,10 +3580,12 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // Remove selection margin from drawing area so text will not be drawn
// on it in unbuffered mode.
- PRectangle rcTextArea = rcClient;
- rcTextArea.left = vs.fixedColumnWidth;
- rcTextArea.right -= vs.rightMarginWidth;
- surfaceWindow->SetClip(rcTextArea);
+ if (!bufferedDraw) {
+ PRectangle rcTextArea = rcClient;
+ rcTextArea.left = vs.fixedColumnWidth;
+ rcTextArea.right -= vs.rightMarginWidth;
+ surfaceWindow->SetClip(rcTextArea);
+ }
// Loop on visible lines
//double durLayout = 0.0;
@@ -3665,7 +3670,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { if (bufferedDraw) {
Point from(vs.fixedColumnWidth, 0);
PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen,
- rcClient.right, yposScreen + vs.lineHeight);
+ rcClient.right - vs.rightMarginWidth, yposScreen + vs.lineHeight);
surfaceWindow->Copy(rcCopyArea, from, *pixmapLine);
}
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index 8162b2c..46f62bf 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -97,7 +97,13 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac return;
}
if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
- surface->DrawRGBAImage(rcWhole, image->GetWidth(), image->GetHeight(), image->Pixels());
+ // Make rectangle just large enough to fit image centred on centre of rcWhole
+ PRectangle rcImage;
+ rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetHeight()) / 2);
+ rcImage.bottom = rcImage.top + image->GetHeight();
+ rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetWidth()) / 2);
+ rcImage.right = rcImage.left + image->GetWidth();
+ surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
return;
}
// Restrict most shapes a bit
@@ -332,7 +338,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType >= SC_MARK_CHARACTER) {
char character[1];
character[0] = static_cast<char>(markType - SC_MARK_CHARACTER);
- int width = surface->WidthText(fontForCharacter, character, 1);
+ XYPOSITION width = surface->WidthText(fontForCharacter, character, 1);
rc.left += (rc.Width() - width) / 2;
rc.right = rc.left + width;
surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2,
diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h index 3657cae..211e234 100644 --- a/scintilla/src/Style.h +++ b/scintilla/src/Style.h @@ -47,7 +47,7 @@ struct FontMeasurements { unsigned int ascent;
unsigned int descent;
unsigned int externalLeading;
- unsigned int aveCharWidth;
+ XYPOSITION aveCharWidth;
XYPOSITION spaceWidth;
int sizeZoomed;
FontMeasurements();
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 32ab6eb..f3a9423 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -819,10 +819,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig if (AlphaBlendFn && rc.Width() > 0) {
HDC hMemDC = ::CreateCompatibleDC(reinterpret_cast<HDC>(hdc));
if (rc.Width() > width)
- rc.left += (rc.Width() - width) / 2;
+ rc.left += static_cast<int>((rc.Width() - width) / 2);
rc.right = rc.left + width;
if (rc.Height() > height)
- rc.top += (rc.Height() - height) / 2;
+ rc.top += static_cast<int>((rc.Height() - height) / 2);
rc.bottom = rc.top + height;
BITMAPINFO bpih = {sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0};
@@ -1405,7 +1405,6 @@ void SurfaceD2D::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired void SurfaceD2D::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) {
if (pRenderTarget) {
- D2DPenColour(back);
D2D1_RECT_F rectangle1 = D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top+0.5, RoundFloat(rc.right) - 0.5, rc.bottom-0.5);
D2DPenColour(back);
pRenderTarget->FillRectangle(&rectangle1, pBrush);
@@ -1465,27 +1464,38 @@ void SurfaceD2D::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesir void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
ColourDesired outline, int alphaOutline, int /* flags*/ ) {
if (pRenderTarget) {
- D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect(
- D2D1::RectF(rc.left+1.0, rc.top+1.0, rc.right-1.0, rc.bottom-1.0),
- cornerSize, cornerSize);
- D2DPenColour(fill, alphaFill);
- pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
+ if (cornerSize == 0) {
+ // When corner size is zero, draw square rectangle to prevent blurry pixels at corners
+ D2D1_RECT_F rectFill = D2D1::RectF(RoundFloat(rc.left) + 1.0, rc.top + 1.0, RoundFloat(rc.right) - 1.0, rc.bottom - 1.0);
+ D2DPenColour(fill, alphaFill);
+ pRenderTarget->FillRectangle(rectFill, pBrush);
+
+ D2D1_RECT_F rectOutline = D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top + 0.5, RoundFloat(rc.right) - 0.5, rc.bottom - 0.5);
+ D2DPenColour(outline, alphaOutline);
+ pRenderTarget->DrawRectangle(rectOutline, pBrush);
+ } else {
+ D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect(
+ D2D1::RectF(RoundFloat(rc.left) + 1.0, rc.top + 1.0, RoundFloat(rc.right) - 1.0, rc.bottom - 1.0),
+ cornerSize, cornerSize);
+ D2DPenColour(fill, alphaFill);
+ pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
- D2D1::RectF(rc.left + 0.5, rc.top+0.5, rc.right - 0.5, rc.bottom-0.5),
- cornerSize, cornerSize);
- D2DPenColour(outline, alphaOutline);
- pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush);
+ D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
+ D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top + 0.5, RoundFloat(rc.right) - 0.5, rc.bottom - 0.5),
+ cornerSize, cornerSize);
+ D2DPenColour(outline, alphaOutline);
+ pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush);
+ }
}
}
void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
if (pRenderTarget) {
if (rc.Width() > width)
- rc.left += (rc.Width() - width) / 2;
+ rc.left += static_cast<int>((rc.Width() - width) / 2);
rc.right = rc.left + width;
if (rc.Height() > height)
- rc.top += (rc.Height() - height) / 2;
+ rc.top += static_cast<int>((rc.Height() - height) / 2);
rc.bottom = rc.top + height;
std::vector<unsigned char> image(height * width * 4);
@@ -1619,7 +1629,7 @@ XYPOSITION SurfaceD2D::WidthText(Font &font_, const char *s, int len) { pTextLayout->Release();
}
}
- return int(width + 0.5);
+ return width;
}
void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) {
@@ -1762,7 +1772,7 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) { pTextLayout->Release();
}
}
- return int(width + 0.5);
+ return width;
}
void SurfaceD2D::SetClip(PRectangle rc) {
|