diff options
author | nyamatongwe <unknown> | 2012-03-01 10:14:07 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2012-03-01 10:14:07 +1100 |
commit | c47e74bd3c77326c28afa1987a33f7875b3c20d2 (patch) | |
tree | 8d5b680371db7c1c5039e0879ee2f9837fda05cb | |
parent | c5a0e5e7516b4fb3263d52abefe6e38fa9f1e094 (diff) | |
download | scintilla-mirror-c47e74bd3c77326c28afa1987a33f7875b3c20d2.tar.gz |
Bug #3494492. Prevent AlphaRectangle() from drawing blurry rectangle under Direct2D.
From Marko Njezic.
-rw-r--r-- | win32/PlatWin.cxx | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index baa2e9ef5..c760e2c4c 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1457,17 +1457,28 @@ 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); - - 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); + 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(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); + } } } |