1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-28 06:34:33 +01:00

Codechange: Use a std::span as input for GfxFillPolygon (#13866)

Instead of a std::vector const reference.
This commit is contained in:
Jonathan G Rennison
2025-03-22 15:16:14 +00:00
committed by GitHub
parent 5764eaaacf
commit be79099a6f
3 changed files with 4 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ typedef std::pair<Point, Point> LineSegment;
* @param offset Offset vector subtracted from all coordinates in the shape.
* @return Vector of undirected line segments.
*/
static std::vector<LineSegment> MakePolygonSegments(const std::vector<Point> &shape, Point offset)
static std::vector<LineSegment> MakePolygonSegments(std::span<const Point> shape, Point offset)
{
std::vector<LineSegment> segments;
if (shape.size() < 3) return segments; // fewer than 3 will always result in an empty polygon
@@ -208,7 +208,7 @@ static std::vector<LineSegment> MakePolygonSegments(const std::vector<Point> &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<Point> &shape, int colour, FillRectMode mode)
void GfxFillPolygon(std::span<const Point> shape, int colour, FillRectMode mode)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;