mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
LibGfx: Clip edges above or below the visible area in the rasterizer
This avoids doing pointless plotting for scanlines that will never be seen. Note: This currently can only clip edges vertically. Horizontal clipping is more tricky, since edges that are not visible can still change how things accumulate across the scanline. Fixes #22382 Sadly, this causes a bunch of LibWeb test churn as this change imperceptibly changes the final rasterized output.
This commit is contained in:
parent
fe04d83ef5
commit
64411127cb
18 changed files with 58 additions and 38 deletions
|
@ -163,13 +163,6 @@ private:
|
|||
struct EdgeExtent {
|
||||
int min_x;
|
||||
int max_x;
|
||||
|
||||
template<typename T>
|
||||
void memset_extent(T* data, int value)
|
||||
{
|
||||
if (min_x <= max_x)
|
||||
memset(data + min_x, value, (max_x - min_x + 1) * sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
void fill_internal(Painter&, Path const&, auto color_or_function, Painter::WindingRule, FloatPoint offset);
|
||||
|
@ -190,7 +183,23 @@ private:
|
|||
|
||||
Vector<SampleType> m_scanline;
|
||||
Vector<WindingCounts> m_windings;
|
||||
Vector<Detail::Edge*> m_edge_table;
|
||||
|
||||
class EdgeTable {
|
||||
public:
|
||||
EdgeTable() = default;
|
||||
|
||||
void set_scanline_range(int min_scanline, int max_scanline)
|
||||
{
|
||||
this->min_scanline = min_scanline;
|
||||
edges.resize(max_scanline - min_scanline + 1);
|
||||
}
|
||||
|
||||
auto& operator[](int scanline) { return edges[scanline - min_scanline]; }
|
||||
|
||||
private:
|
||||
Vector<Detail::Edge*> edges;
|
||||
int min_scanline { 0 };
|
||||
} m_edge_table;
|
||||
};
|
||||
|
||||
extern template class EdgeFlagPathRasterizer<8>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue