diff options
| author | nyamatongwe <unknown> | 2012-07-02 22:11:37 +1000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2012-07-02 22:11:37 +1000 | 
| commit | 1f2ab5d4563bfcda43a25e4b778ad81d6b4fe790 (patch) | |
| tree | b1dbdc0ea222d5de2ec98cd9d938deb35fe46b07 /win32/PlatWin.cxx | |
| parent | 3c44b38e1edd7e0cbe644d2a9ff4a29e0867c3eb (diff) | |
| download | scintilla-mirror-1f2ab5d4563bfcda43a25e4b778ad81d6b4fe790.tar.gz | |
Implement clipped text drawing on Direct2D. This will improve drawing of
text blobs and block carets.
From Marko Njezic.
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 22ee361ba..aa98918b8 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1567,12 +1567,16 @@ void SurfaceD2D::Copy(PRectangle rc, Point from, Surface &surfaceSource) {  	}  } -void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT) { +void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT fuOptions) {  	SetFont(font_);  	// Use Unicode calls  	const TextWide tbuf(s, len, unicodeMode, codePage);  	if (pRenderTarget && pTextFormat && pBrush) { +		if (fuOptions & ETO_CLIPPED) { +			D2D1_RECT_F rcClip = {rc.left, rc.top, rc.right, rc.bottom}; +			pRenderTarget->PushAxisAlignedClip(rcClip, D2D1_ANTIALIAS_MODE_ALIASED); +		}  		// Explicitly creating a text layout appears a little faster   		IDWriteTextLayout *pTextLayout; @@ -1583,6 +1587,10 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, co  			pRenderTarget->DrawTextLayout(origin, pTextLayout, pBrush, D2D1_DRAW_TEXT_OPTIONS_NONE);  			pTextLayout->Release();  		} + +		if (fuOptions & ETO_CLIPPED) { +			pRenderTarget->PopAxisAlignedClip(); +		}  	}  }  | 
