Ver código fonte

LibGfx: Disable line intersection stroking for 1px lines

1px lines are already connected, so this just makes things look worse
and is often painting in the wrong spot anyway.
MacDue 2 anos atrás
pai
commit
b8492006da
1 arquivos alterados com 9 adições e 10 exclusões
  1. 9 10
      Userland/Libraries/LibGfx/AntiAliasingPainter.cpp

+ 9 - 10
Userland/Libraries/LibGfx/AntiAliasingPainter.cpp

@@ -228,16 +228,15 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick
             cursor = segment.point();
             break;
         case Segment::Type::LineTo:
-            if (!first_line.has_value())
-                first_line = FloatLine(cursor, segment.point());
-
             draw_line(cursor, segment.point(), color, thickness);
-            if (previous_was_line) {
-                stroke_segment_intersection(cursor, segment.point(), last_line, color, thickness);
+            if (thickness > 1) {
+                if (!first_line.has_value())
+                    first_line = FloatLine(cursor, segment.point());
+                if (previous_was_line)
+                    stroke_segment_intersection(cursor, segment.point(), last_line, color, thickness);
+                last_line.set_a(cursor);
+                last_line.set_b(segment.point());
             }
-
-            last_line.set_a(cursor);
-            last_line.set_b(segment.point());
             cursor = segment.point();
             break;
         case Segment::Type::QuadraticBezierCurveTo: {
@@ -264,8 +263,8 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick
         previous_was_line = segment.type() == Segment::Type::LineTo;
     }
 
-    // check if the figure was started and closed as line at the same position
-    if (previous_was_line && path.segments().size() >= 2 && path.segments().first().point() == cursor && (path.segments().first().type() == Segment::Type::LineTo || (path.segments().first().type() == Segment::Type::MoveTo && path.segments()[1].type() == Segment::Type::LineTo)))
+    // Check if the figure was started and closed as line at the same position.
+    if (thickness > 1 && previous_was_line && path.segments().size() >= 2 && path.segments().first().point() == cursor && (path.segments().first().type() == Segment::Type::LineTo || (path.segments().first().type() == Segment::Type::MoveTo && path.segments()[1].type() == Segment::Type::LineTo)))
         stroke_segment_intersection(first_line.value().a(), first_line.value().b(), last_line, color, thickness);
 }