mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
LibGfx: Fix some more antialiased line off-by-ones
Turns out most things expect lines to include the endpoint, e.g. 0,0 -> 3,0 is a 4px long line. But the fill_path() implementation seems to expect the line to be the distance between the two points (so the above example is a 3px line instead). This now adds an option to pick between PointToPoint line length or Distance line length and uses the latter for fill_path().
This commit is contained in:
parent
acc0fceaae
commit
40e978df85
3 changed files with 26 additions and 12 deletions
|
@ -47,8 +47,8 @@ void fill_path(Painter& painter, Path const& path, Color color, Gfx::Painter::Wi
|
|||
using GridCoordinateType = Conditional<fill_path_mode == FillPathMode::PlaceOnIntGrid, int, float>;
|
||||
using PointType = Point<GridCoordinateType>;
|
||||
auto draw_line = [&](auto... args) {
|
||||
if constexpr (requires { painter.draw_line_for_path(args...); })
|
||||
painter.draw_line_for_path(args...);
|
||||
if constexpr (requires { painter.draw_line_for_fill_path(args...); })
|
||||
painter.draw_line_for_fill_path(args...);
|
||||
else
|
||||
painter.draw_line(args...);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue