diff --git a/src/gfx.cpp b/src/gfx.cpp index 21dfc75292..f116343b00 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -169,7 +169,7 @@ typedef std::pair LineSegment; * @param offset Offset vector subtracted from all coordinates in the shape. * @return Vector of undirected line segments. */ -static std::vector MakePolygonSegments(const std::vector &shape, Point offset) +static std::vector MakePolygonSegments(std::span shape, Point offset) { std::vector segments; if (shape.size() < 3) return segments; // fewer than 3 will always result in an empty polygon @@ -208,7 +208,7 @@ static std::vector MakePolygonSegments(const std::vector &sh * FILLRECT_CHECKER: Fill every other pixel with the specified colour, in a checkerboard pattern. * FILLRECT_RECOLOUR: Apply a recolour sprite to every pixel in the polygon. */ -void GfxFillPolygon(const std::vector &shape, int colour, FillRectMode mode) +void GfxFillPolygon(std::span shape, int colour, FillRectMode mode) { Blitter *blitter = BlitterFactory::GetCurrentBlitter(); const DrawPixelInfo *dpi = _cur_dpi; diff --git a/src/gfx_func.h b/src/gfx_func.h index 90e0ba15c8..d7febfdc74 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -101,7 +101,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, void DrawCharCentered(char32_t c, const Rect &r, TextColour colour); void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode = FILLRECT_OPAQUE); -void GfxFillPolygon(const std::vector &shape, int colour, FillRectMode mode = FILLRECT_OPAQUE); +void GfxFillPolygon(std::span shape, int colour, FillRectMode mode = FILLRECT_OPAQUE); void GfxDrawLine(int left, int top, int right, int bottom, int colour, int width = 1, int dash = 0); void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3); void DrawRectOutline(const Rect &r, int colour, int width = 1, int dash = 0); diff --git a/src/slider.cpp b/src/slider.cpp index 362174ee0e..c5dd1c15ea 100644 --- a/src/slider.cpp +++ b/src/slider.cpp @@ -45,7 +45,7 @@ void DrawSliderWidget(Rect r, int min_value, int max_value, int nmarks, int valu const uint shadow = GetColourGradient(COLOUR_GREY, SHADE_DARK); const uint fill = GetColourGradient(COLOUR_GREY, SHADE_LIGHTER); const uint light = GetColourGradient(COLOUR_GREY, SHADE_LIGHTEST); - const std::vector wedge{ Point{wx1, r.bottom - ha}, Point{wx2, r.top + ha}, Point{wx2, r.bottom - ha} }; + const std::array wedge{ Point{wx1, r.bottom - ha}, Point{wx2, r.top + ha}, Point{wx2, r.bottom - ha} }; GfxFillPolygon(wedge, fill); GfxDrawLine(wedge[0].x, wedge[0].y, wedge[2].x, wedge[2].y, light, t); GfxDrawLine(wedge[1].x, wedge[1].y, wedge[2].x, wedge[2].y, _current_text_dir == TD_RTL ? shadow : light, t);