25 explicit DlRegion(
const std::vector<SkIRect>& rects);
49 std::vector<SkIRect>
getRects(
bool deband =
true)
const;
62 bool isEmpty()
const {
return lines_.empty(); }
72 typedef std::uint32_t SpanChunkHandle;
79 Span(int32_t left, int32_t right) : left(left), right(right) {}
87 SpanBuffer() =
default;
88 SpanBuffer(
const SpanBuffer&);
89 SpanBuffer(SpanBuffer&& m);
90 SpanBuffer& operator=(
const SpanBuffer&);
91 SpanBuffer& operator=(SpanBuffer&& m);
93 void reserve(
size_t capacity);
94 size_t capacity()
const {
return capacity_; }
96 SpanChunkHandle storeChunk(
const Span*
begin,
const Span*
end);
97 size_t getChunkSize(SpanChunkHandle handle)
const;
98 void getSpans(SpanChunkHandle handle,
99 const DlRegion::Span*&
begin,
100 const DlRegion::Span*&
end)
const;
105 void setChunkSize(SpanChunkHandle handle,
size_t size);
107 size_t capacity_ = 0;
112 Span* spans_ =
nullptr;
118 SpanChunkHandle chunk_handle;
121 void setRects(
const std::vector<SkIRect>& rects);
123 void appendLine(int32_t top,
127 void appendLine(int32_t top,
130 SpanChunkHandle handle) {
133 appendLine(top, bottom,
begin,
end);
136 typedef std::vector<Span> SpanVec;
137 SpanLine makeLine(int32_t top, int32_t bottom,
const SpanVec&);
138 SpanLine makeLine(int32_t top,
142 static size_t unionLineSpans(std::vector<Span>& res,
143 const SpanBuffer& a_buffer,
144 SpanChunkHandle a_handle,
145 const SpanBuffer& b_buffer,
146 SpanChunkHandle b_handle);
147 static size_t intersectLineSpans(std::vector<Span>& res,
148 const SpanBuffer& a_buffer,
149 SpanChunkHandle a_handle,
150 const SpanBuffer& b_buffer,
151 SpanChunkHandle b_handle);
153 bool spansEqual(SpanLine& line,
const Span*
begin,
const Span*
end)
const;
155 static bool spansIntersect(
const Span* begin1,
160 static void getIntersectionIterators(
161 const std::vector<SpanLine>& a_lines,
162 const std::vector<SpanLine>& b_lines,
163 std::vector<SpanLine>::const_iterator& a_it,
164 std::vector<SpanLine>::const_iterator& b_it);
166 std::vector<SpanLine> lines_;
168 SpanBuffer span_buffer_;