diff options
| author | nyamatongwe <unknown> | 2003-03-21 11:23:06 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2003-03-21 11:23:06 +0000 | 
| commit | f8db78deb32adc9340f8bcc53598f33eba9369e9 (patch) | |
| tree | 07e6a47587fb6ac201e7e503447e3ad743df16ed | |
| parent | bcf82e5884991c7b87160100eeca25577ce15308 (diff) | |
| download | scintilla-mirror-f8db78deb32adc9340f8bcc53598f33eba9369e9.tar.gz | |
Optimising by not drawing space characters in transparent mode.
| -rw-r--r-- | win32/PlatWin.cxx | 36 | 
1 files changed, 21 insertions, 15 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 1636e6c94..2d51b4023 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -557,22 +557,28 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const c  void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len,  	ColourAllocated fore) { -	SetFont(font_); -	::SetTextColor(hdc, fore.AsLong()); -	::SetBkMode(hdc, TRANSPARENT); -	RECT rcw = RectFromPRectangle(rc); -	if (unicodeMode) { -		wchar_t tbuf[MAX_US_LEN]; -		int tlen = UCS2FromUTF8(s, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1); -		tbuf[tlen] = L'\0'; -		::ExtTextOutW(hdc, rc.left, ybase, 0, &rcw, tbuf, tlen, NULL); -	} else { -		// There appears to be a 16 bit string length limit in GDI -		if (len > 65535) -			len = 65535; -		::ExtTextOut(hdc, rc.left, ybase, 0, &rcw, s, len, NULL); +	// Avoid drawing spaces in transparent mode +	for (int i=0;i<len;i++) { +		if (s[i] != ' ') { +			SetFont(font_); +			::SetTextColor(hdc, fore.AsLong()); +			::SetBkMode(hdc, TRANSPARENT); +			RECT rcw = RectFromPRectangle(rc); +			if (unicodeMode) { +				wchar_t tbuf[MAX_US_LEN]; +				int tlen = UCS2FromUTF8(s, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1); +				tbuf[tlen] = L'\0'; +				::ExtTextOutW(hdc, rc.left, ybase, 0, &rcw, tbuf, tlen, NULL); +			} else { +				// There appears to be a 16 bit string length limit in GDI +				if (len > 65535) +					len = 65535; +				::ExtTextOut(hdc, rc.left, ybase, 0, &rcw, s, len, NULL); +			} +			::SetBkMode(hdc, OPAQUE); +			return; +		}  	} -	::SetBkMode(hdc, OPAQUE);  }  int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { | 
