diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-05-03 13:30:18 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-05-03 13:30:18 +1000 | 
| commit | 9e90d41b58d6eafbf90a7435ea40c8c94e0aa1b1 (patch) | |
| tree | c3e24e4e33c77abd593fc7f6d88f61c07c33d57b /src | |
| parent | 32cae5a3a2c79282abba21a07d60130f05d86cea (diff) | |
| download | scintilla-mirror-9e90d41b58d6eafbf90a7435ea40c8c94e0aa1b1.tar.gz | |
Using casts and an alternate PRectangle constructor to make XYPOSITION <-> int
conversions and other conversions more consistent.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 8 | ||||
| -rw-r--r-- | src/Editor.cxx | 7 | ||||
| -rw-r--r-- | src/Indicator.cxx | 2 | ||||
| -rw-r--r-- | src/LineMarker.cxx | 4 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 8 | ||||
| -rw-r--r-- | src/XPM.cxx | 6 | 
6 files changed, 18 insertions, 17 deletions
| diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 04ae6c593..804bb9769 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -165,9 +165,9 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,  int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {  	PRectangle rcClientPos = wCallTip.GetClientPosition(); -	PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, +	PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,  	                        rcClientPos.bottom - rcClientPos.top); -	PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); +	PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);  	// To make a nice small call tip window, it is only sized to fit most normal characters without accents  	int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)); @@ -218,9 +218,9 @@ void CallTip::PaintCT(Surface *surfaceWindow) {  	if (val.empty())  		return;  	PRectangle rcClientPos = wCallTip.GetClientPosition(); -	PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, +	PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,  	                        rcClientPos.bottom - rcClientPos.top); -	PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); +	PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);  	surfaceWindow->FillRectangle(rcClient, colourBG); diff --git a/src/Editor.cxx b/src/Editor.cxx index e96588023..946e0fe2b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2423,7 +2423,7 @@ ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,  void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) {  	Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); -	PRectangle rcCopyArea(start + 1, rcSegment.top, start + 2, rcSegment.bottom); +	PRectangle rcCopyArea(start + 1, static_cast<int>(rcSegment.top), start + 2, static_cast<int>(rcSegment.bottom));  	surface->Copy(rcCopyArea, from,  	        highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide);  } @@ -3124,7 +3124,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  											rcSegment.bottom);  										surface->FillRectangle(rcSpace, textBack);  									} -									PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); +									PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f);  									rcDot.right = rcDot.left + vs.whitespaceSize;  									rcDot.bottom = rcDot.top + vs.whitespaceSize;  									surface->FillRectangle(rcDot, textFore); @@ -3705,7 +3705,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  				if (bufferedDraw) {  					Point from(vs.textStart-leftTextOverlap, 0);  					PRectangle rcCopyArea(vs.textStart-leftTextOverlap, yposScreen, -					        rcClient.right - vs.rightMarginWidth, yposScreen + vs.lineHeight); +					        static_cast<int>(rcClient.right - vs.rightMarginWidth), +					        yposScreen + vs.lineHeight);  					surfaceWindow->Copy(rcCopyArea, from, *pixmapLine);  				} diff --git a/src/Indicator.cxx b/src/Indicator.cxx index ac7435156..45dccc8e2 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -20,7 +20,7 @@ using namespace Scintilla;  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); +	return PRectangle(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));  }  void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index dec359a91..3bf671b6e 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -344,11 +344,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  			character, 1, fore, back);  	} else if (markType == SC_MARK_DOTDOTDOT) { -		int right = centreX - 6; +		XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);  		for (int b=0; b<3; b++) {  			PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);  			surface->FillRectangle(rcBlob, fore); -			right += 5; +			right += 5.0f;  		}  	} else if (markType == SC_MARK_ARROWS) {  		surface->PenColour(fore); diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index b1c9dc10b..af808f3c1 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -75,12 +75,12 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, cons  	if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER)	// Hangs if sizeZoomed <= 1  		sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; -	float deviceHeight = surface.DeviceHeightFont(sizeZoomed); +	float deviceHeight = static_cast<float>(surface.DeviceHeightFont(sizeZoomed));  	FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet);  	font.Create(fp); -	ascent = surface.Ascent(font); -	descent = surface.Descent(font); +	ascent = static_cast<unsigned int>(surface.Ascent(font)); +	descent = static_cast<unsigned int>(surface.Descent(font));  	aveCharWidth = surface.AverageCharWidth(font);  	spaceWidth = surface.WidthChar(font, ' ');  } @@ -347,7 +347,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {  	controlCharWidth = 0.0;  	if (controlCharSymbol >= 32) { -		controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, controlCharSymbol); +		controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast<char>(controlCharSymbol));  	}  	fixedColumnWidth = marginInside ? leftMarginWidth : 0; diff --git a/src/XPM.cxx b/src/XPM.cxx index e1d91846d..b3c9b338f 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -109,7 +109,7 @@ void XPM::Init(const char *const *linesForm) {  		if (*colourDef == '#') {  			colour.Set(colourDef);  		} else { -			codeTransparent = code; +			codeTransparent = static_cast<char>(code);  		}  		colourCodeTable[code] = colour;  	} @@ -127,8 +127,8 @@ void XPM::Draw(Surface *surface, PRectangle &rc) {  		return;  	}  	// Centre the pixmap -	int startY = rc.top + (rc.Height() - height) / 2; -	int startX = rc.left + (rc.Width() - width) / 2; +	int startY = static_cast<int>(rc.top + (rc.Height() - height) / 2); +	int startX = static_cast<int>(rc.left + (rc.Width() - width) / 2);  	for (int y=0; y<height; y++) {  		int prevCode = 0;  		int xStartRun = 0; | 
