cl2_render: Use memset when rendering outline

A minor cleanup that replaces the for-loop rendering for a fill run
with memsets.
This commit is contained in:
Gleb Mazovetskiy 2021-05-22 14:28:43 +01:00 committed by Anders Jenbo
commit bb95e0c337

View file

@ -341,8 +341,18 @@ void RenderOutlineForPixel(std::uint8_t *dst, int dstPitch, std::uint8_t color)
template <bool North, bool West, bool South, bool East>
void RenderOutlineForPixels(std::uint8_t *dst, int dstPitch, int width, std::uint8_t color)
{
while (width-- > 0)
RenderOutlineForPixel<North, West, South, East>(dst++, dstPitch, color);
if (North)
std::memset(dst - dstPitch, color, width);
if (West && East)
std::memset(dst - 1, color, width + 2);
else if (West)
std::memset(dst - 1, color, width);
else if (East)
std::memset(dst + 1, color, width);
if (South)
std::memset(dst + dstPitch, color, width);
}
template <bool North, bool West, bool South, bool East>