diff options
author | Neil <nyamatongwe@gmail.com> | 2023-03-27 09:29:48 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-03-27 09:29:48 +1100 |
commit | 765390e6db2b69976448e92d9a86516ead9b0c09 (patch) | |
tree | eb01e21aae213bc8422ffdee8c99e4521c28dde8 /win32 | |
parent | 481b5651df9bd160d4ff1f1ba471eead61a53252 (diff) | |
download | scintilla-mirror-765390e6db2b69976448e92d9a86516ead9b0c09.tar.gz |
Declare const where possible.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/PlatWin.cxx | 20 | ||||
-rw-r--r-- | win32/PlatWin.h | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index c3157416a..dbb929620 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1713,19 +1713,19 @@ void SurfaceD2D::RoundedRectangle(PRectangle rc, FillStroke fillStroke) { 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 = { + const D2D1_ROUNDED_RECT roundedRectFill = { RectangleFromPRectangle(rc), radius, radius }; D2DPenColourAlpha(fillStroke.fill.colour); pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); } else { - D2D1_ROUNDED_RECT roundedRectFill = { + const 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 = { + const D2D1_ROUNDED_RECT roundedRect = { RectangleFromPRectangle(rc.Inset(0.5)), radius, radius }; D2DPenColourAlpha(fillStroke.stroke.colour); @@ -1749,12 +1749,12 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke pRenderTarget->DrawRectangle(rectOutline, pBrush, fillStroke.stroke.WidthF()); } else { const float cornerSizeF = static_cast<float>(cornerSize); - D2D1_ROUNDED_RECT roundedRectFill = { + const D2D1_ROUNDED_RECT roundedRectFill = { rectFill, cornerSizeF - 1.0f, cornerSizeF - 1.0f }; D2DPenColourAlpha(fillStroke.fill.colour); pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); - D2D1_ROUNDED_RECT roundedRect = { + const D2D1_ROUNDED_RECT roundedRect = { rectOutline, cornerSizeF, cornerSizeF}; D2DPenColourAlpha(fillStroke.stroke.colour); pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF()); @@ -1814,7 +1814,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig ID2D1Bitmap *bitmap = nullptr; const D2D1_SIZE_U size = D2D1::SizeU(width, height); - D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM, + const D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}, 72.0, 72.0}; const HRESULT hr = pRenderTarget->CreateBitmap(size, image.data(), width * 4, &props, &bitmap); @@ -1857,12 +1857,12 @@ void SurfaceD2D::Stadium(PRectangle rc, FillStroke fillStroke, Ends ends) { const FLOAT halfStroke = fillStroke.stroke.WidthF() / 2.0f; if (ends == Surface::Ends::semiCircles) { const D2D1_RECT_F rect = RectangleFromPRectangle(rc); - D2D1_ROUNDED_RECT roundedRectFill = { RectangleInset(rect, fillStroke.stroke.WidthF()), + const D2D1_ROUNDED_RECT roundedRectFill = { RectangleInset(rect, fillStroke.stroke.WidthF()), radiusFill, radiusFill }; D2DPenColourAlpha(fillStroke.fill.colour); pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush); - D2D1_ROUNDED_RECT roundedRect = { RectangleInset(rect, halfStroke), + const D2D1_ROUNDED_RECT roundedRect = { RectangleInset(rect, halfStroke), radius, radius }; D2DPenColourAlpha(fillStroke.stroke.colour); pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF()); @@ -2869,7 +2869,7 @@ void Window::SetCursor(Cursor curs) { coordinates */ PRectangle Window::GetMonitorRect(Point pt) { const PRectangle rcPosition = GetPosition(); - POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left), + const POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left), static_cast<LONG>(pt.y + rcPosition.top)}; HMONITOR hMonitor = MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST); @@ -2915,7 +2915,7 @@ public: } void AllocItem(const char *text, int pixId) { - ListItemData lid = { text, pixId }; + const ListItemData lid = { text, pixId }; data.push_back(lid); } diff --git a/win32/PlatWin.h b/win32/PlatWin.h index 1391723dd..8ce798cf1 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -19,7 +19,7 @@ extern void Platform_Initialise(void *hInstance) noexcept; extern void Platform_Finalise(bool fromDllMain) noexcept; constexpr RECT RectFromPRectangle(PRectangle prc) noexcept { - RECT rc = { static_cast<LONG>(prc.left), static_cast<LONG>(prc.top), + const RECT rc = { static_cast<LONG>(prc.left), static_cast<LONG>(prc.top), static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom) }; return rc; } |