Add a functor fill mode to GfxFillPolygon
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user