Browse Source

LibWeb: Add support for conic gradient transition hints in Skia painter

Aliaksandr Kalenik 1 year ago
parent
commit
761fa97fef
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp

+ 5 - 1
Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp

@@ -1167,10 +1167,14 @@ CommandResult DisplayListPlayerSkia::paint_conic_gradient(PaintConicGradient con
 
     auto const& color_stop_list = conic_gradient_data.color_stops.list;
     VERIFY(!color_stop_list.is_empty());
+    auto stops_with_replaced_transition_hints = replace_transition_hints_with_normal_color_stops(color_stop_list);
 
     Vector<SkColor> colors;
     Vector<SkScalar> positions;
-    for (auto const& stop : color_stop_list) {
+    for (size_t stop_index = 0; stop_index < stops_with_replaced_transition_hints.size(); stop_index++) {
+        auto const& stop = stops_with_replaced_transition_hints[stop_index];
+        if (stop_index > 0 && stop == stops_with_replaced_transition_hints[stop_index - 1])
+            continue;
         colors.append(to_skia_color(stop.color));
         positions.append(stop.position);
     }