mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-01 13:49:05 +00:00
LibGfx: Make accumulate_even_odd_scanline() go faster
...by checking scanline vector bounds before entering the loop.
This commit is contained in:
parent
c413cd0f74
commit
05f9733192
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 05f9733192
Pull-request: https://github.com/SerenityOS/serenity/pull/24431
1 changed files with 4 additions and 2 deletions
|
@ -309,10 +309,12 @@ template<unsigned SamplesPerPixel>
|
||||||
auto EdgeFlagPathRasterizer<SamplesPerPixel>::accumulate_even_odd_scanline(EdgeExtent edge_extent, auto init, auto sample_callback)
|
auto EdgeFlagPathRasterizer<SamplesPerPixel>::accumulate_even_odd_scanline(EdgeExtent edge_extent, auto init, auto sample_callback)
|
||||||
{
|
{
|
||||||
SampleType sample = init;
|
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) {
|
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);
|
sample_callback(x, sample);
|
||||||
m_scanline[x] = 0;
|
m_scanline.data()[x] = 0;
|
||||||
}
|
}
|
||||||
return sample;
|
return sample;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue