diff options
author | Neil <nyamatongwe@gmail.com> | 2025-03-29 18:14:57 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-03-29 18:14:57 +1100 |
commit | ba688f069206dc113d16b97a03dc3ff78497597d (patch) | |
tree | 0398bbe861d6bf8d84c93ad96db0106d120c1656 /win32/SurfaceGDI.cxx | |
parent | 9ccbd1eb1fb1c53fc7be721f98b0acb207e56723 (diff) | |
download | scintilla-mirror-ba688f069206dc113d16b97a03dc3ff78497597d.tar.gz |
Use constant definitions to avoid warnings.
Diffstat (limited to 'win32/SurfaceGDI.cxx')
-rw-r--r-- | win32/SurfaceGDI.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/win32/SurfaceGDI.cxx b/win32/SurfaceGDI.cxx index 9fc1ee50c..9df4deb97 100644 --- a/win32/SurfaceGDI.cxx +++ b/win32/SurfaceGDI.cxx @@ -431,10 +431,11 @@ void SurfaceGDI::RoundedRectangle(PRectangle rc, FillStroke fillStroke) { PenColour(fillStroke.stroke.colour, fillStroke.stroke.width); BrushColour(fillStroke.fill.colour); const RECT rcw = RectFromPRectangle(rc); + constexpr int cornerSize = 8; ::RoundRect(hdc, rcw.left + 1, rcw.top, rcw.right - 1, rcw.bottom, - 8, 8); + cornerSize, cornerSize); } // DIBSection is bitmap with some drawing operations used by SurfaceGDI. @@ -497,11 +498,15 @@ ColourRGBA GradientValue(const std::vector<ColourStop> &stops, XYPOSITION propor } constexpr DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) noexcept { - return (a << 24) | (r << 16) | (g << 8) | b; + constexpr int aShift = 24; + constexpr int rShift = 16; + constexpr int gShift = 8; + return (a << aShift) | (r << rShift) | (g << gShift) | b; } constexpr byte AlphaScaled(unsigned char component, unsigned int alpha) noexcept { - return static_cast<byte>(component * alpha / 255); + constexpr byte maxByte = 0xFFU; + return (component * alpha / maxByte) & maxByte; } constexpr DWORD dwordMultiplied(ColourRGBA colour) noexcept { |