@@ -742,7 +742,7 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c
742
742
743
743
#define IM_POLYLINE_PRIM_MAKE_LOCAL () ImDrawVert* IM_POLYLINE_PRIM_VTX_WRITE = this ->_VtxWritePtr; ImDrawIdx* IM_POLYLINE_PRIM_IDX_WRITE = this ->_IdxWritePtr; unsigned int IM_POLYLINE_PRIM_IDX_BASE = this ->_VtxCurrentIdx
744
744
#define IM_POLYLINE_PRIM_LOAD_LOCAL () IM_POLYLINE_PRIM_VTX_WRITE = this ->_VtxWritePtr; IM_POLYLINE_PRIM_IDX_WRITE = this ->_IdxWritePtr; IM_POLYLINE_PRIM_IDX_BASE = this ->_VtxCurrentIdx
745
- #define IM_POLYLINE_PRIM_SAVE_LOCAL () this ->_VtxWritePtr = IM_POLYLINE_PRIM_VTX_WRITE; this ->_IdxWritePtr = IM_POLYLINE_PRIM_IDX_WRITE; this ->_VtxCurrentIdx = IM_POLYLINE_PRIM_IDX_BASE
745
+ #define IM_POLYLINE_PRIM_SAVE_LOCAL () this ->_VtxWritePtr = IM_POLYLINE_PRIM_VTX_WRITE; this ->_IdxWritePtr = IM_POLYLINE_PRIM_IDX_WRITE; this ->_VtxCurrentIdx = IM_POLYLINE_PRIM_IDX_BASE
746
746
#else
747
747
#define IM_POLYLINE_PRIM_VTX_WRITE this->_VtxWritePtr
748
748
#define IM_POLYLINE_PRIM_IDX_WRITE this->_IdxWritePtr
@@ -1275,79 +1275,79 @@ void ImDrawList::_PolylineThinAntiAliased(const ImDrawListPolyline& polyline)
1275
1275
if (preferred_join == Miter) IM_LIKELY
1276
1276
{
1277
1277
if (cos_theta > IM_POLYLINE_MITER_ANGLE_LIMIT) IM_LIKELY
1278
- {
1279
- // Fill gap between segments with Miter join
1280
- //
1281
- // Left Miter join: Right Miter join:
1282
- //
1283
- // , | ,
1284
- // 6 .' ~ | ~ '. 8
1285
- // 5' .+. | .+. '5
1286
- // +:. '. .' | '. .' .:+
1287
- // | ''..:. .' | '. .:..'' |
1288
- // +--------+-- ~ | ~ --+--------+
1289
- // 3| 7| | |7 |4
1290
- //
1291
-
1292
- if (sin_theta < 0 .0f )
1293
1278
{
1294
- IM_POLYLINE_VERTEX (5 , p1.x - miter_offset_x, p1.y - miter_offset_y, uv, polyline.fringe_color );
1279
+ // Fill gap between segments with Miter join
1280
+ //
1281
+ // Left Miter join: Right Miter join:
1282
+ //
1283
+ // , | ,
1284
+ // 6 .' ~ | ~ '. 8
1285
+ // 5' .+. | .+. '5
1286
+ // +:. '. .' | '. .' .:+
1287
+ // | ''..:. .' | '. .:..'' |
1288
+ // +--------+-- ~ | ~ --+--------+
1289
+ // 3| 7| | |7 |4
1290
+ //
1295
1291
1296
- IM_POLYLINE_TRIANGLE_BEGIN (6 );
1297
- IM_POLYLINE_TRIANGLE (0 , 3 , 7 , 5 );
1298
- IM_POLYLINE_TRIANGLE (1 , 5 , 7 , 6 );
1299
- IM_POLYLINE_TRIANGLE_END (6 );
1300
- }
1301
- else
1302
- {
1303
- IM_POLYLINE_VERTEX (5 , p1.x + miter_offset_x, p1.y + miter_offset_y, uv, polyline.fringe_color );
1292
+ if (sin_theta < 0 .0f )
1293
+ {
1294
+ IM_POLYLINE_VERTEX (5 , p1.x - miter_offset_x, p1.y - miter_offset_y, uv, polyline.fringe_color );
1304
1295
1305
- IM_POLYLINE_TRIANGLE_BEGIN (6 );
1306
- IM_POLYLINE_TRIANGLE (0 , 4 , 5 , 7 );
1307
- IM_POLYLINE_TRIANGLE (1 , 5 , 8 , 7 );
1308
- IM_POLYLINE_TRIANGLE_END (6 );
1296
+ IM_POLYLINE_TRIANGLE_BEGIN (6 );
1297
+ IM_POLYLINE_TRIANGLE (0 , 3 , 7 , 5 );
1298
+ IM_POLYLINE_TRIANGLE (1 , 5 , 7 , 6 );
1299
+ IM_POLYLINE_TRIANGLE_END (6 );
1300
+ }
1301
+ else
1302
+ {
1303
+ IM_POLYLINE_VERTEX (5 , p1.x + miter_offset_x, p1.y + miter_offset_y, uv, polyline.fringe_color );
1304
+
1305
+ IM_POLYLINE_TRIANGLE_BEGIN (6 );
1306
+ IM_POLYLINE_TRIANGLE (0 , 4 , 5 , 7 );
1307
+ IM_POLYLINE_TRIANGLE (1 , 5 , 8 , 7 );
1308
+ IM_POLYLINE_TRIANGLE_END (6 );
1309
1309
}
1310
1310
}
1311
1311
}
1312
1312
else if (preferred_join == Bevel) IM_UNLIKELY
1313
1313
{
1314
1314
if (cos_theta > IM_POLYLINE_MITER_ANGLE_LIMIT) IM_LIKELY
1315
- {
1316
- // Fill gap between segments with Bevel join
1317
- //
1318
- // Left Bevel join: Right Bevel join:
1319
- //
1320
- // , | ,
1321
- // 6 .' ~ | ~ '. 8
1322
- // +. | .+
1323
- // ' '. .' | '. .' '
1324
- // ' '. .' | '. .' '
1325
- // +--------+-- ~ | ~ --+--------+
1326
- // 3| 7| | |7 |4
1327
- //
1315
+ {
1316
+ // Fill gap between segments with Bevel join
1317
+ //
1318
+ // Left Bevel join: Right Bevel join:
1319
+ //
1320
+ // , | ,
1321
+ // 6 .' ~ | ~ '. 8
1322
+ // +. | .+
1323
+ // ' '. .' | '. .' '
1324
+ // ' '. .' | '. .' '
1325
+ // +--------+-- ~ | ~ --+--------+
1326
+ // 3| 7| | |7 |4
1327
+ //
1328
1328
1329
- float bevel_normal_x, bevel_normal_y;
1330
- IM_POLYLINE_BEVEL_NORMAL (bevel_normal_x, bevel_normal_y);
1329
+ float bevel_normal_x, bevel_normal_y;
1330
+ IM_POLYLINE_BEVEL_NORMAL (bevel_normal_x, bevel_normal_y);
1331
1331
1332
- float dir_0_x, dir_0_y, dir_1_x, dir_1_y;
1333
- IM_POLYLINE_BEVEL_VECTORS (bevel_normal_x, bevel_normal_y, dir_0_x, dir_0_y, dir_1_x, dir_1_y, half_thickness);
1332
+ float dir_0_x, dir_0_y, dir_1_x, dir_1_y;
1333
+ IM_POLYLINE_BEVEL_VECTORS (bevel_normal_x, bevel_normal_y, dir_0_x, dir_0_y, dir_1_x, dir_1_y, half_thickness);
1334
1334
1335
- if (sin_theta < 0 .0f )
1336
- {
1337
- IM_POLYLINE_VERTEX (3 , p1.x - dir_0_x, p1.y - dir_0_y, uv, polyline.fringe_color );
1338
- IM_POLYLINE_VERTEX (6 , p1.x - dir_1_x, p1.y - dir_1_y, uv, polyline.fringe_color );
1335
+ if (sin_theta < 0 .0f )
1336
+ {
1337
+ IM_POLYLINE_VERTEX (3 , p1.x - dir_0_x, p1.y - dir_0_y, uv, polyline.fringe_color );
1338
+ IM_POLYLINE_VERTEX (6 , p1.x - dir_1_x, p1.y - dir_1_y, uv, polyline.fringe_color );
1339
1339
1340
- IM_POLYLINE_TRIANGLE_BEGIN (3 );
1341
- IM_POLYLINE_TRIANGLE (0 , 3 , 7 , 6 );
1342
- IM_POLYLINE_TRIANGLE_END (3 );
1343
- }
1344
- else
1345
- {
1346
- IM_POLYLINE_VERTEX (4 , p1.x + dir_0_x, p1.y + dir_0_y, uv, polyline.fringe_color );
1347
- IM_POLYLINE_VERTEX (8 , p1.x + dir_1_x, p1.y + dir_1_y, uv, polyline.fringe_color );
1340
+ IM_POLYLINE_TRIANGLE_BEGIN (3 );
1341
+ IM_POLYLINE_TRIANGLE (0 , 3 , 7 , 6 );
1342
+ IM_POLYLINE_TRIANGLE_END (3 );
1343
+ }
1344
+ else
1345
+ {
1346
+ IM_POLYLINE_VERTEX (4 , p1.x + dir_0_x, p1.y + dir_0_y, uv, polyline.fringe_color );
1347
+ IM_POLYLINE_VERTEX (8 , p1.x + dir_1_x, p1.y + dir_1_y, uv, polyline.fringe_color );
1348
1348
1349
- IM_POLYLINE_TRIANGLE_BEGIN (3 );
1350
- IM_POLYLINE_TRIANGLE (1 , 7 , 4 , 8 );
1349
+ IM_POLYLINE_TRIANGLE_BEGIN (3 );
1350
+ IM_POLYLINE_TRIANGLE (1 , 7 , 4 , 8 );
1351
1351
IM_POLYLINE_TRIANGLE_END (3 );
1352
1352
}
1353
1353
}
@@ -2719,7 +2719,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
2719
2719
polyline.fringe_thickness = polyline.thickness + fringe_width * 2 .0f ;
2720
2720
}
2721
2721
2722
- if (polyline.thickness <= 0 .0f ) IM_LIKELY
2722
+ if (polyline.thickness <= 0 .0f ) IM_LIKELY
2723
2723
this ->_PolylineThinAntiAliased (polyline);
2724
2724
else
2725
2725
this ->_PolylineThickAntiAliased (polyline);
@@ -3426,7 +3426,7 @@ void ImDrawList::AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float th
3426
3426
// Note we don't render 1 pixels sized rectangles properly.
3427
3427
void ImDrawList::AddRect (const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawFlags flags, float thickness)
3428
3428
{
3429
- if ((col & IM_COL32_A_MASK) == 0 )
3429
+ if ((col & IM_COL32_A_MASK) == 0 || thickness <= 0 . 0f ) IM_UNLIKELY
3430
3430
return ;
3431
3431
3432
3432
if (GImGui->IO .KeyCtrl || (flags & 0x80000000u ))
@@ -3472,8 +3472,8 @@ if (GImGui->IO.KeyCtrl || (flags & 0x80000000u))
3472
3472
if (rounding >= 0 .5f )
3473
3473
{
3474
3474
flags = FixRectCornerFlags (flags);
3475
- rounding = ImMin (rounding, ImFabs (b.x - a.x - half_outer_thickness ) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0 .5f : 1 .0f ) - 1 .0f );
3476
- rounding = ImMin (rounding, ImFabs (b.y - a.y - half_outer_thickness ) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0 .5f : 1 .0f ) - 1 .0f );
3475
+ rounding = ImMin (rounding, ImFabs (b.x - a.x ) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0 .5f : 1 .0f ) - 1 .0f );
3476
+ rounding = ImMin (rounding, ImFabs (b.y - a.y ) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0 .5f : 1 .0f ) - 1 .0f );
3477
3477
}
3478
3478
if (rounding < 0 .5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
3479
3479
{
@@ -3494,8 +3494,8 @@ if (GImGui->IO.KeyCtrl || (flags & 0x80000000u))
3494
3494
}
3495
3495
else
3496
3496
{
3497
- const int arc_step = ImMax (1 , IM_DRAWLIST_ARCFAST_SAMPLE_MAX / _CalcCircleAutoSegmentCount (rounding));
3498
- const float arc_offset_correction = 0 .207107f * _FringeScale; // sqrt(2)/4
3497
+ const int arc_step = ImMax (1 , IM_DRAWLIST_ARCFAST_SAMPLE_MAX / _CalcCircleAutoSegmentCount (rounding + half_outer_thickness ));
3498
+ const float arc_offset_correction = 0 .207107f * _FringeScale; // sqrt(2)/2
3499
3499
3500
3500
#define IM_ADDRECT_EMIT_ARC (P, R, A_MIN, A_MAX ) _PathArcToFastEx(P, R, (A_MIN) * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12 , (A_MAX) * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12 , arc_step)
3501
3501
#define IM_ADDRECT_EMIT_ROUNDED_PATH (AX, AY, BX, BY, ROUNDING ) \
0 commit comments