|
@@ -860,26 +860,26 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12)
|
|
|
|
|
|
+void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12)
|
|
{
|
|
{
|
|
if (radius == 0.0f || a_min_of_12 > a_max_of_12)
|
|
if (radius == 0.0f || a_min_of_12 > a_max_of_12)
|
|
{
|
|
{
|
|
- _Path.push_back(centre);
|
|
|
|
|
|
+ _Path.push_back(center);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
_Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1));
|
|
_Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1));
|
|
for (int a = a_min_of_12; a <= a_max_of_12; a++)
|
|
for (int a = a_min_of_12; a <= a_max_of_12; a++)
|
|
{
|
|
{
|
|
const ImVec2& c = _Data->CircleVtx12[a % IM_ARRAYSIZE(_Data->CircleVtx12)];
|
|
const ImVec2& c = _Data->CircleVtx12[a % IM_ARRAYSIZE(_Data->CircleVtx12)];
|
|
- _Path.push_back(ImVec2(centre.x + c.x * radius, centre.y + c.y * radius));
|
|
|
|
|
|
+ _Path.push_back(ImVec2(center.x + c.x * radius, center.y + c.y * radius));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments)
|
|
|
|
|
|
+void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments)
|
|
{
|
|
{
|
|
if (radius == 0.0f)
|
|
if (radius == 0.0f)
|
|
{
|
|
{
|
|
- _Path.push_back(centre);
|
|
|
|
|
|
+ _Path.push_back(center);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -889,7 +889,7 @@ void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float a_min, floa
|
|
for (int i = 0; i <= num_segments; i++)
|
|
for (int i = 0; i <= num_segments; i++)
|
|
{
|
|
{
|
|
const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);
|
|
const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);
|
|
- _Path.push_back(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius));
|
|
|
|
|
|
+ _Path.push_back(ImVec2(center.x + ImCos(a) * radius, center.y + ImSin(a) * radius));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -968,44 +968,46 @@ void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDr
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)
|
|
|
|
|
|
+void ImDrawList::AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
- PathLineTo(a + ImVec2(0.5f,0.5f));
|
|
|
|
- PathLineTo(b + ImVec2(0.5f,0.5f));
|
|
|
|
|
|
+ PathLineTo(p1 + ImVec2(0.5f, 0.5f));
|
|
|
|
+ PathLineTo(p2 + ImVec2(0.5f, 0.5f));
|
|
PathStroke(col, false, thickness);
|
|
PathStroke(col, false, thickness);
|
|
}
|
|
}
|
|
|
|
|
|
-// a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly.
|
|
|
|
-void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners, float thickness)
|
|
|
|
|
|
+// p_min = upper-left, p_max = lower-right
|
|
|
|
+// Note we don't render 1 pixels sized rectangles properly.
|
|
|
|
+void ImDrawList::AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners, float thickness)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
if (Flags & ImDrawListFlags_AntiAliasedLines)
|
|
if (Flags & ImDrawListFlags_AntiAliasedLines)
|
|
- PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.50f,0.50f), rounding, rounding_corners);
|
|
|
|
|
|
+ PathRect(p_min + ImVec2(0.50f,0.50f), p_max - ImVec2(0.50f,0.50f), rounding, rounding_corners);
|
|
else
|
|
else
|
|
- PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.49f,0.49f), rounding, rounding_corners); // Better looking lower-right corner and rounded non-AA shapes.
|
|
|
|
|
|
+ PathRect(p_min + ImVec2(0.50f,0.50f), p_max - ImVec2(0.49f,0.49f), rounding, rounding_corners); // Better looking lower-right corner and rounded non-AA shapes.
|
|
PathStroke(col, true, thickness);
|
|
PathStroke(col, true, thickness);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners)
|
|
|
|
|
|
+void ImDrawList::AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
if (rounding > 0.0f)
|
|
if (rounding > 0.0f)
|
|
{
|
|
{
|
|
- PathRect(a, b, rounding, rounding_corners);
|
|
|
|
|
|
+ PathRect(p_min, p_max, rounding, rounding_corners);
|
|
PathFillConvex(col);
|
|
PathFillConvex(col);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
PrimReserve(6, 4);
|
|
PrimReserve(6, 4);
|
|
- PrimRect(a, b, col);
|
|
|
|
|
|
+ PrimRect(p_min, p_max, col);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
|
|
|
|
|
|
+// p_min = upper-left, p_max = lower-right
|
|
|
|
+void ImDrawList::AddRectFilledMultiColor(const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
|
|
{
|
|
{
|
|
if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)
|
|
if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
@@ -1014,77 +1016,77 @@ void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32
|
|
PrimReserve(6, 4);
|
|
PrimReserve(6, 4);
|
|
PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2));
|
|
PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2));
|
|
PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+3));
|
|
PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+3));
|
|
- PrimWriteVtx(a, uv, col_upr_left);
|
|
|
|
- PrimWriteVtx(ImVec2(c.x, a.y), uv, col_upr_right);
|
|
|
|
- PrimWriteVtx(c, uv, col_bot_right);
|
|
|
|
- PrimWriteVtx(ImVec2(a.x, c.y), uv, col_bot_left);
|
|
|
|
|
|
+ PrimWriteVtx(p_min, uv, col_upr_left);
|
|
|
|
+ PrimWriteVtx(ImVec2(p_max.x, p_min.y), uv, col_upr_right);
|
|
|
|
+ PrimWriteVtx(p_max, uv, col_bot_right);
|
|
|
|
+ PrimWriteVtx(ImVec2(p_min.x, p_max.y), uv, col_bot_left);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness)
|
|
|
|
|
|
+void ImDrawList::AddQuad(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
- PathLineTo(a);
|
|
|
|
- PathLineTo(b);
|
|
|
|
- PathLineTo(c);
|
|
|
|
- PathLineTo(d);
|
|
|
|
|
|
+ PathLineTo(p1);
|
|
|
|
+ PathLineTo(p2);
|
|
|
|
+ PathLineTo(p3);
|
|
|
|
+ PathLineTo(p4);
|
|
PathStroke(col, true, thickness);
|
|
PathStroke(col, true, thickness);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col)
|
|
|
|
|
|
+void ImDrawList::AddQuadFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
- PathLineTo(a);
|
|
|
|
- PathLineTo(b);
|
|
|
|
- PathLineTo(c);
|
|
|
|
- PathLineTo(d);
|
|
|
|
|
|
+ PathLineTo(p1);
|
|
|
|
+ PathLineTo(p2);
|
|
|
|
+ PathLineTo(p3);
|
|
|
|
+ PathLineTo(p4);
|
|
PathFillConvex(col);
|
|
PathFillConvex(col);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness)
|
|
|
|
|
|
+void ImDrawList::AddTriangle(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
- PathLineTo(a);
|
|
|
|
- PathLineTo(b);
|
|
|
|
- PathLineTo(c);
|
|
|
|
|
|
+ PathLineTo(p1);
|
|
|
|
+ PathLineTo(p2);
|
|
|
|
+ PathLineTo(p3);
|
|
PathStroke(col, true, thickness);
|
|
PathStroke(col, true, thickness);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col)
|
|
|
|
|
|
+void ImDrawList::AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
- PathLineTo(a);
|
|
|
|
- PathLineTo(b);
|
|
|
|
- PathLineTo(c);
|
|
|
|
|
|
+ PathLineTo(p1);
|
|
|
|
+ PathLineTo(p2);
|
|
|
|
+ PathLineTo(p3);
|
|
PathFillConvex(col);
|
|
PathFillConvex(col);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness)
|
|
|
|
|
|
+void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
|
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
|
return;
|
|
return;
|
|
|
|
|
|
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
- const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
|
- PathArcTo(centre, radius-0.5f, 0.0f, a_max, num_segments - 1);
|
|
|
|
|
|
+ const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
|
+ PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
|
|
PathStroke(col, true, thickness);
|
|
PathStroke(col, true, thickness);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments)
|
|
|
|
|
|
+void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
|
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
|
return;
|
|
return;
|
|
|
|
|
|
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
- const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
|
- PathArcTo(centre, radius, 0.0f, a_max, num_segments - 1);
|
|
|
|
|
|
+ const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
|
+ PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);
|
|
PathFillConvex(col);
|
|
PathFillConvex(col);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1132,7 +1134,7 @@ void ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, c
|
|
AddText(NULL, 0.0f, pos, col, text_begin, text_end);
|
|
AddText(NULL, 0.0f, pos, col, text_begin, text_end);
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col)
|
|
|
|
|
|
+void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
@@ -1142,13 +1144,13 @@ void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const Im
|
|
PushTextureID(user_texture_id);
|
|
PushTextureID(user_texture_id);
|
|
|
|
|
|
PrimReserve(6, 4);
|
|
PrimReserve(6, 4);
|
|
- PrimRectUV(a, b, uv_a, uv_b, col);
|
|
|
|
|
|
+ PrimRectUV(p_min, p_max, uv_min, uv_max, col);
|
|
|
|
|
|
if (push_texture_id)
|
|
if (push_texture_id)
|
|
PopTextureID();
|
|
PopTextureID();
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col)
|
|
|
|
|
|
+void ImDrawList::AddImageQuad(ImTextureID user_texture_id, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1, const ImVec2& uv2, const ImVec2& uv3, const ImVec2& uv4, ImU32 col)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
@@ -1158,20 +1160,20 @@ void ImDrawList::AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, cons
|
|
PushTextureID(user_texture_id);
|
|
PushTextureID(user_texture_id);
|
|
|
|
|
|
PrimReserve(6, 4);
|
|
PrimReserve(6, 4);
|
|
- PrimQuadUV(a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
|
|
|
|
|
|
+ PrimQuadUV(p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
|
|
|
|
|
|
if (push_texture_id)
|
|
if (push_texture_id)
|
|
PopTextureID();
|
|
PopTextureID();
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners)
|
|
|
|
|
|
+void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners)
|
|
{
|
|
{
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
if ((col & IM_COL32_A_MASK) == 0)
|
|
return;
|
|
return;
|
|
|
|
|
|
if (rounding <= 0.0f || (rounding_corners & ImDrawCornerFlags_All) == 0)
|
|
if (rounding <= 0.0f || (rounding_corners & ImDrawCornerFlags_All) == 0)
|
|
{
|
|
{
|
|
- AddImage(user_texture_id, a, b, uv_a, uv_b, col);
|
|
|
|
|
|
+ AddImage(user_texture_id, p_min, p_max, uv_min, uv_max, col);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1180,10 +1182,10 @@ void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, c
|
|
PushTextureID(user_texture_id);
|
|
PushTextureID(user_texture_id);
|
|
|
|
|
|
int vert_start_idx = VtxBuffer.Size;
|
|
int vert_start_idx = VtxBuffer.Size;
|
|
- PathRect(a, b, rounding, rounding_corners);
|
|
|
|
|
|
+ PathRect(p_min, p_max, rounding, rounding_corners);
|
|
PathFillConvex(col);
|
|
PathFillConvex(col);
|
|
int vert_end_idx = VtxBuffer.Size;
|
|
int vert_end_idx = VtxBuffer.Size;
|
|
- ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, a, b, uv_a, uv_b, true);
|
|
|
|
|
|
+ ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, p_min, p_max, uv_min, uv_max, true);
|
|
|
|
|
|
if (push_texture_id)
|
|
if (push_texture_id)
|
|
PopTextureID();
|
|
PopTextureID();
|