diff options
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 293e7d3cb..761c00193 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1651,17 +1651,27 @@ void SurfaceD2D::FillRectangle(PRectangle rc, Surface &surfacePattern) { void SurfaceD2D::RoundedRectangle(PRectangle rc, FillStroke fillStroke) { if (pRenderTarget) { - D2D1_ROUNDED_RECT roundedRectFill = { - RectangleFromPRectangle(rc.Inset(1.0)), - 4, 4}; - D2DPenColourAlpha(fillStroke.fill.colour); - pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); + const FLOAT minDimension = static_cast<FLOAT>(std::min(rc.Width(), rc.Height())) / 2.0f; + const FLOAT radius = std::min(4.0f, minDimension); + if (fillStroke.fill.colour == fillStroke.stroke.colour) { + D2D1_ROUNDED_RECT roundedRectFill = { + RectangleFromPRectangle(rc), + radius, radius }; + D2DPenColourAlpha(fillStroke.fill.colour); + pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); + } else { + D2D1_ROUNDED_RECT roundedRectFill = { + RectangleFromPRectangle(rc.Inset(1.0)), + radius-1, radius-1 }; + D2DPenColourAlpha(fillStroke.fill.colour); + pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); - D2D1_ROUNDED_RECT roundedRect = { - RectangleFromPRectangle(rc.Inset(0.5)), - 4, 4}; - D2DPenColourAlpha(fillStroke.stroke.colour); - pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF()); + D2D1_ROUNDED_RECT roundedRect = { + RectangleFromPRectangle(rc.Inset(0.5)), + radius, radius }; + D2DPenColourAlpha(fillStroke.stroke.colour); + pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF()); + } } } |