Fixed issues with border corner radii
This commit is contained in:
parent
d3797acedd
commit
97759ce585
@ -128,7 +128,21 @@ namespace cairo {
|
|||||||
context& operator<<(const circle_segment& segment) {
|
context& operator<<(const circle_segment& segment) {
|
||||||
cairo_new_sub_path(m_c);
|
cairo_new_sub_path(m_c);
|
||||||
cairo_arc(m_c, segment.x, segment.y, segment.radius, segment.angle_from * degree, segment.angle_to * degree);
|
cairo_arc(m_c, segment.x, segment.y, segment.radius, segment.angle_from * degree, segment.angle_to * degree);
|
||||||
cairo_line_to(m_c, segment.x, segment.y);
|
switch ((int)segment.angle_to) {
|
||||||
|
case 0:
|
||||||
|
cairo_rel_line_to(m_c, -segment.w, 0);
|
||||||
|
break;
|
||||||
|
case 90:
|
||||||
|
cairo_rel_line_to(m_c, 0, -segment.w);
|
||||||
|
break;
|
||||||
|
case 180:
|
||||||
|
cairo_rel_line_to(m_c, segment.w, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cairo_rel_line_to(m_c, 0, segment.w);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cairo_arc_negative(m_c, segment.x, segment.y, segment.radius - segment.w, segment.angle_to * degree, segment.angle_from * degree);
|
||||||
cairo_close_path(m_c);
|
cairo_close_path(m_c);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ namespace cairo {
|
|||||||
struct circle_segment {
|
struct circle_segment {
|
||||||
double x;
|
double x;
|
||||||
double y;
|
double y;
|
||||||
|
double w;
|
||||||
double angle_from;
|
double angle_from;
|
||||||
double angle_to;
|
double angle_to;
|
||||||
double radius;
|
double radius;
|
||||||
|
@ -587,6 +587,7 @@ void renderer::fill_borders() {
|
|||||||
borderTL.y = m_bar.borders.at(edge::TOP).size + m_bar.radius.top_left;
|
borderTL.y = m_bar.borders.at(edge::TOP).size + m_bar.radius.top_left;
|
||||||
borderTL.angle_from = 180;
|
borderTL.angle_from = 180;
|
||||||
borderTL.angle_to = 270;
|
borderTL.angle_to = 270;
|
||||||
|
borderTL.w = m_bar.borders.at(edge::LEFT).size;
|
||||||
(*m_context << borderTL << m_bar.borders.at(edge::LEFT).color).fill();
|
(*m_context << borderTL << m_bar.borders.at(edge::LEFT).color).fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,6 +598,7 @@ void renderer::fill_borders() {
|
|||||||
borderBL.y = m_bar.size.h - (m_bar.borders.at(edge::BOTTOM).size + m_bar.radius.bottom_left);
|
borderBL.y = m_bar.size.h - (m_bar.borders.at(edge::BOTTOM).size + m_bar.radius.bottom_left);
|
||||||
borderBL.angle_from = 90;
|
borderBL.angle_from = 90;
|
||||||
borderBL.angle_to = 180;
|
borderBL.angle_to = 180;
|
||||||
|
borderBL.w = m_bar.borders.at(edge::LEFT).size;
|
||||||
(*m_context << borderBL << m_bar.borders.at(edge::LEFT).color).fill();
|
(*m_context << borderBL << m_bar.borders.at(edge::LEFT).color).fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,6 +609,7 @@ void renderer::fill_borders() {
|
|||||||
borderTR.y = m_bar.borders.at(edge::TOP).size + m_bar.radius.top_right;
|
borderTR.y = m_bar.borders.at(edge::TOP).size + m_bar.radius.top_right;
|
||||||
borderTR.angle_from = -90;
|
borderTR.angle_from = -90;
|
||||||
borderTR.angle_to = 0;
|
borderTR.angle_to = 0;
|
||||||
|
borderTR.w = m_bar.borders.at(edge::RIGHT).size;
|
||||||
(*m_context << borderTR << m_bar.borders.at(edge::RIGHT).color).fill();
|
(*m_context << borderTR << m_bar.borders.at(edge::RIGHT).color).fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,6 +620,7 @@ void renderer::fill_borders() {
|
|||||||
borderBR.y = m_bar.size.h - (m_bar.borders.at(edge::BOTTOM).size + m_bar.radius.bottom_right);
|
borderBR.y = m_bar.size.h - (m_bar.borders.at(edge::BOTTOM).size + m_bar.radius.bottom_right);
|
||||||
borderBR.angle_from = 0;
|
borderBR.angle_from = 0;
|
||||||
borderBR.angle_to = 90;
|
borderBR.angle_to = 90;
|
||||||
|
borderBR.w = m_bar.borders.at(edge::RIGHT).size;
|
||||||
(*m_context << borderBR << m_bar.borders.at(edge::RIGHT).color).fill();
|
(*m_context << borderBR << m_bar.borders.at(edge::RIGHT).color).fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user