xref: /aosp_15_r20/external/skia/modules/bentleyottmann/include/SweepLine.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 // Copyright 2023 Google LLC
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 
4 #ifndef SweepLine_DEFINED
5 #define SweepLine_DEFINED
6 
7 #include "modules/bentleyottmann/include/EventQueueInterface.h"
8 #include "modules/bentleyottmann/include/Segment.h"
9 
10 #include <cstdint>
11 #include <vector>
12 
13 namespace bentleyottmann {
14 struct Point;
15 
16 class SweepLine : public SweepLineInterface {
17 public:
18     SweepLine();
19 
20     void handleDeletions(Point eventPoint, const DeletionSegmentSet& removing) override;
21 
22     void handleInsertionsAndCheckForNewCrossings(Point eventPoint,
23                                                  const InsertionSegmentSet& inserting,
24                                                  EventQueueInterface* queue) override;
25 
26 private:
27     friend struct SweepLineTestingPeer;
28 
29     void verify(int32_t y) const;
30 
31     std::vector<Segment> fSweepLine;
32 };
33 }  // namespace bentleyottmann
34 #endif  // SweepLine_DEFINED
35