Add a functor fill mode to GfxFillPolygon

This commit is contained in:
Jonathan G Rennison
2022-05-19 00:12:17 +01:00
parent 9fddfdeccf
commit 981104e308
3 changed files with 10 additions and 2 deletions

View File

@@ -226,8 +226,9 @@ static std::vector<LineSegment> MakePolygonSegments(const std::vector<Point> &sh
* FILLRECT_OPAQUE: Fill the polygon with the specified colour.
* 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.
* FILLRECT_FUNCTOR: Apply a functor to a line of pixels.
*/
void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mode)
void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mode, GfxFillRectModeFunctor *fill_functor)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;
@@ -308,6 +309,10 @@ void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mo
blitter->SetPixel(dst, x, 0, (uint8)colour);
}
break;
case FILLRECT_FUNCTOR:
/* Call the provided fill functor. */
fill_functor(dst, x2 - x1);
break;
}
}