Skip to content

Commit

Permalink
LibGfx: Make accumulate_even_odd_scanline() go faster
Browse files Browse the repository at this point in the history
...by checking scanline vector bounds before entering the loop.
  • Loading branch information
kalenikaliaksandr committed May 24, 2024
1 parent 2921bba commit f2f303e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Userland/Libraries/LibGfx/EdgeFlagPathRasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,12 @@ template<unsigned SamplesPerPixel>
auto EdgeFlagPathRasterizer<SamplesPerPixel>::accumulate_even_odd_scanline(EdgeExtent edge_extent, auto init, auto sample_callback)
{
SampleType sample = init;
VERIFY(edge_extent.min_x >= 0);
VERIFY(edge_extent.max_x <= static_cast<int>(m_scanline.size()));
for (int x = edge_extent.min_x; x <= edge_extent.max_x; x += 1) {
sample ^= m_scanline[x];
sample ^= m_scanline.data()[x];
sample_callback(x, sample);
m_scanline[x] = 0;
m_scanline.data()[x] = 0;
}
return sample;
}
Expand Down

0 comments on commit f2f303e

Please sign in to comment.