mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibGfx: Skip horizontal edges in path rasterizer
Only the vertical parts of edges are plotted (then accumulated horizontally). Fully horizontal edges won't be plotted (and just result in NaNs).
This commit is contained in:
parent
4380be9d01
commit
2fa488cfa9
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/MacDue
Commit: 2fa488cfa9
Pull-request: https://github.com/SerenityOS/serenity/pull/22547
1 changed files with 7 additions and 4 deletions
|
@ -70,16 +70,19 @@ static Vector<Detail::Edge> prepare_edges(ReadonlySpan<FloatLine> lines, unsigne
|
|||
if (max_y < top_clip)
|
||||
continue;
|
||||
|
||||
float start_x = p0.x();
|
||||
float end_x = p1.x();
|
||||
|
||||
auto start_x = p0.x();
|
||||
auto end_x = p1.x();
|
||||
auto dx = end_x - start_x;
|
||||
auto dy = max_y - min_y;
|
||||
|
||||
if (dy == 0)
|
||||
continue;
|
||||
|
||||
auto dxdy = dx / dy;
|
||||
|
||||
// Trim off the non-visible portions of the edge.
|
||||
if (min_y < top_clip) {
|
||||
start_x += (top_clip - min_y) * dxdy;
|
||||
start_x += dxdy * (top_clip - min_y);
|
||||
min_y = top_clip;
|
||||
}
|
||||
if (max_y > bottom_clip) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue