62 if (stroke_width_ < 0.0) {
71 Scalar stroke_width = std::max(stroke_width_, min_size);
72 Scalar half_stroke_width = stroke_width * 0.5f;
75 const Rect& rect = rect_;
76 bool interior_filled = (stroke_width >= rect.
GetSize().MinDimension());
78 switch (stroke_join_) {
86 auto vertex_count = trigs.
size() * 4;
87 if (!interior_filled) {
98 .vertex_buffer = data_host_buffer.Emplace(
100 [hsw = half_stroke_width, &rect, vertex_count, &trigs,
101 interior_filled](uint8_t* buffer) {
107 auto vertices =
reinterpret_cast<Point*
>(buffer);
109 auto vertices_end = vertices + vertex_count;
114 for (
auto trig : trigs) {
117 *vertices++ =
Point(left - trig.sin * hsw,
118 top - trig.cos * hsw);
119 *vertices++ =
Point(right + trig.sin * hsw,
120 top - trig.cos * hsw);
127 if (interior_filled) {
138 *vertices++ =
Point(left - hsw, top + hsw);
139 *vertices++ =
Point(right + hsw, top + hsw);
151 *vertices++ =
Point(right - hsw, top + hsw);
152 *vertices++ =
Point(right + hsw, bottom - hsw);
153 *vertices++ =
Point(right - hsw, bottom - hsw);
159 *vertices++ =
Point(right - hsw, bottom - hsw);
160 *vertices++ =
Point(left + hsw, top + hsw);
166 *vertices++ =
Point(left + hsw, top + hsw);
167 *vertices++ =
Point(left - hsw, top + hsw);
168 *vertices++ =
Point(left + hsw, bottom - hsw);
169 *vertices++ =
Point(left - hsw, bottom - hsw);
182 *vertices++ =
Point(right + hsw, bottom - hsw);
189 for (
auto trig : trigs) {
192 *vertices++ =
Point(left - trig.cos * hsw,
193 bottom + trig.sin * hsw);
194 *vertices++ =
Point(right + trig.cos * hsw,
195 bottom + trig.sin * hsw);
201 .vertex_count = vertex_count,
210 if (interior_filled) {
215 .vertex_buffer = data_host_buffer.Emplace(
217 [hsw = half_stroke_width, &rect](uint8_t* buffer) {
222 auto vertices =
reinterpret_cast<Point*
>(buffer);
223 vertices[0] =
Point(left, top - hsw);
224 vertices[1] =
Point(right, top - hsw);
225 vertices[2] =
Point(left - hsw, top);
226 vertices[3] =
Point(right + hsw, top);
227 vertices[4] =
Point(left - hsw, bottom);
228 vertices[5] =
Point(right + hsw, bottom);
229 vertices[6] =
Point(left, bottom + hsw);
230 vertices[7] =
Point(right, bottom + hsw);
243 .vertex_buffer = data_host_buffer.Emplace(
245 [hsw = half_stroke_width, &rect](uint8_t* buffer) {
250 auto vertices =
reinterpret_cast<Point*
>(buffer);
251 vertices[0] =
Point(left - hsw, top);
252 vertices[1] =
Point(left + hsw, top + hsw);
253 vertices[2] =
Point(left, top - hsw);
254 vertices[3] =
Point(right - hsw, top + hsw);
255 vertices[4] =
Point(right, top - hsw);
256 vertices[5] =
Point(right - hsw, top + hsw);
257 vertices[6] =
Point(right + hsw, top);
258 vertices[7] =
Point(right - hsw, bottom - hsw);
259 vertices[8] =
Point(right + hsw, bottom);
260 vertices[9] =
Point(right - hsw, bottom - hsw);
261 vertices[10] =
Point(right, bottom + hsw);
262 vertices[11] =
Point(left + hsw, bottom - hsw);
263 vertices[12] =
Point(left, bottom + hsw);
264 vertices[13] =
Point(left + hsw, bottom - hsw);
265 vertices[14] =
Point(left - hsw, bottom);
266 vertices[15] =
Point(left + hsw, top + hsw);
267 vertices[16] =
Point(left - hsw, top);
278 if (interior_filled) {
283 .vertex_buffer = data_host_buffer.Emplace(
285 [hsw = half_stroke_width, &rect](uint8_t* buffer) {
290 auto vertices =
reinterpret_cast<Point*
>(buffer);
292 vertices[0] =
Point(left - hsw, top - hsw);
293 vertices[1] =
Point(right + hsw, top - hsw);
294 vertices[2] =
Point(left - hsw, bottom + hsw);
295 vertices[3] =
Point(right + hsw, bottom + hsw);
308 .vertex_buffer = data_host_buffer.Emplace(
310 [hsw = half_stroke_width, &rect](uint8_t* buffer) {
315 auto vertices =
reinterpret_cast<Point*
>(buffer);
316 vertices[0] =
Point(left - hsw, top - hsw);
317 vertices[1] =
Point(left + hsw, top + hsw);
318 vertices[2] =
Point(right + hsw, top - hsw);
319 vertices[3] =
Point(right - hsw, top + hsw);
320 vertices[4] =
Point(right + hsw, bottom + hsw);
321 vertices[5] =
Point(right - hsw, bottom - hsw);
322 vertices[6] =
Point(left - hsw, bottom + hsw);
323 vertices[7] =
Point(left + hsw, bottom - hsw);
324 vertices[8] =
Point(left - hsw, top - hsw);
325 vertices[9] =
Point(left + hsw, top + hsw);
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
Tessellator & GetTessellator() const