AA branch: Fixes.

This commit is contained in:
ocornut 2015-04-09 22:40:50 +01:00
parent 1e69175403
commit e0cd947904
2 changed files with 5 additions and 14 deletions

View File

@ -7844,14 +7844,6 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
PrimVtx(v1 + hn, uv, col); PrimVtx(v1 + hn, uv, col);
PrimVtx(v1 - hn, uv, col); PrimVtx(v1 - hn, uv, col);
} }
/*
const float inv_length = 1.0f / sqrtf(ImLengthSqr(b - a));
const float aa_size = 1.0f;
const ImVec2 hn = (b - a) * (thickness * 0.5f * inv_length);// half normalized
const ImVec2 hp0 = ImVec2(+hn.y, -hn.x); // half perpendiculars + user offset
const ImVec2 hp1 = ImVec2(-hn.y, +hn.x);
*/
} }
} }
@ -8031,14 +8023,13 @@ void ImDrawList::Rect(const ImVec2& a, const ImVec2& b, float rounding, int roun
} }
} }
void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness) void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)
{ {
if ((col >> 24) == 0) if ((col >> 24) == 0)
return; return;
LineTo(a); LineTo(a);
LineTo(b); LineTo(b);
Stroke(col, false); Stroke(col, thickness, false);
(void)half_thickness;
} }
void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners) void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners)
@ -8046,7 +8037,7 @@ void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float roun
if ((col >> 24) == 0) if ((col >> 24) == 0)
return; return;
Rect(a + ImVec2(0.5f,0.5f), b + ImVec2(0.5f,0.5f), rounding, rounding_corners); Rect(a + ImVec2(0.5f,0.5f), b + ImVec2(0.5f,0.5f), rounding, rounding_corners);
Stroke(col, true); Stroke(col, 1.0f, true);
} }
void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners) void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners)
@ -8074,7 +8065,7 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu
const float a_max = PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments; const float a_max = PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
ArcTo(centre, radius, 0.0f, a_max, num_segments); ArcTo(centre, radius, 0.0f, a_max, num_segments);
Stroke(col, true); Stroke(col, 1.0f, true);
} }
void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments) void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments)

View File

@ -914,7 +914,7 @@ struct ImDrawList
IMGUI_API void ArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 12); IMGUI_API void ArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 12);
IMGUI_API void Rect(const ImVec2& a, const ImVec2& b, float rounding = 0.0f, int rounding_corners = 0x0F); IMGUI_API void Rect(const ImVec2& a, const ImVec2& b, float rounding = 0.0f, int rounding_corners = 0x0F);
IMGUI_API void Fill(ImU32 col); IMGUI_API void Fill(ImU32 col);
IMGUI_API void Stroke(ImU32 col, float thickness, bool closed = false); IMGUI_API void Stroke(ImU32 col, float thickness, bool closed);
// Primitives // Primitives
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);