diff options
| -rw-r--r-- | win32/PlatWin.cxx | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 6fdaa8c94..d89ae2b89 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1143,6 +1143,14 @@ void SurfaceGDI::SetBidiR2L(bool) {  #if defined(USE_D2D) +namespace { + +constexpr D2D1_RECT_F RectangleFromPRectangle(PRectangle rc) noexcept { +	return { rc.left, rc.top, rc.right, rc.bottom }; +} + +} +  class BlobInline;  class SurfaceD2D : public Surface { @@ -1609,7 +1617,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig  		const HRESULT hr = pRenderTarget->CreateBitmap(size, image.data(),                    width * 4, &props, &bitmap);  		if (SUCCEEDED(hr)) { -			D2D1_RECT_F rcDestination = {rc.left, rc.top, rc.right, rc.bottom}; +			const D2D1_RECT_F rcDestination = RectangleFromPRectangle(rc);  			pRenderTarget->DrawBitmap(bitmap, rcDestination);  			ReleaseUnknown(bitmap);  		} @@ -1639,7 +1647,7 @@ void SurfaceD2D::Copy(PRectangle rc, Point from, Surface &surfaceSource) {  	ID2D1Bitmap *pBitmap = nullptr;  	HRESULT hr = pCompatibleRenderTarget->GetBitmap(&pBitmap);  	if (SUCCEEDED(hr)) { -		D2D1_RECT_F rcDestination = {rc.left, rc.top, rc.right, rc.bottom}; +		const D2D1_RECT_F rcDestination = RectangleFromPRectangle(rc);  		D2D1_RECT_F rcSource = {from.x, from.y, from.x + rc.Width(), from.y + rc.Height()};  		pRenderTarget->DrawBitmap(pBitmap, rcDestination, 1.0f,  			D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, rcSource); @@ -2054,7 +2062,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font &font_, XYPOSITION yba  	const TextWide tbuf(text, unicodeMode, codePageText);  	if (pRenderTarget && pTextFormat && pBrush) {  		if (fuOptions & ETO_CLIPPED) { -			D2D1_RECT_F rcClip = {rc.left, rc.top, rc.right, rc.bottom}; +			const D2D1_RECT_F rcClip = RectangleFromPRectangle(rc);  			pRenderTarget->PushAxisAlignedClip(rcClip, D2D1_ANTIALIAS_MODE_ALIASED);  		} @@ -2246,7 +2254,7 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) {  void SurfaceD2D::SetClip(PRectangle rc) {  	if (pRenderTarget) { -		D2D1_RECT_F rcClip = {rc.left, rc.top, rc.right, rc.bottom}; +		const D2D1_RECT_F rcClip = RectangleFromPRectangle(rc);  		pRenderTarget->PushAxisAlignedClip(rcClip, D2D1_ANTIALIAS_MODE_ALIASED);  		clipsActive++;  	} | 
