mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 11:12:49 +00:00
Fix SNIPaddingTop for sideways bar
This commit is contained in:
parent
f78758c4ee
commit
42a0710551
1 changed files with 18 additions and 5 deletions
|
@ -533,15 +533,28 @@ void Texture::Draw(cairo_t* cr)
|
||||||
double scaleX = q.size / m_Width;
|
double scaleX = q.size / m_Width;
|
||||||
double scaleY = q.size / m_Height;
|
double scaleY = q.size / m_Height;
|
||||||
|
|
||||||
|
double paddingX, paddingY;
|
||||||
|
if (m_Angle == 90)
|
||||||
|
{
|
||||||
|
// Hack for sideways bars
|
||||||
|
paddingX = -m_Padding;
|
||||||
|
paddingY = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paddingX = 0;
|
||||||
|
paddingY = m_Padding;
|
||||||
|
}
|
||||||
// Rotate around center of Quad
|
// Rotate around center of Quad
|
||||||
cairo_rectangle(cr, q.x, q.y + m_Padding, q.size, q.size);
|
cairo_translate(cr, q.x + paddingX + q.size / 2, q.y + paddingY + q.size / 2);
|
||||||
|
|
||||||
cairo_translate(cr, q.x + q.size / 2, q.y + m_Padding + q.size / 2);
|
|
||||||
cairo_rotate(cr, m_Angle * M_PI / 180.0);
|
cairo_rotate(cr, m_Angle * M_PI / 180.0);
|
||||||
cairo_translate(cr, -(q.x + q.size / 2), -(q.y + m_Padding + q.size / 2));
|
cairo_translate(cr, -(q.x + paddingX + q.size / 2), -(q.y + paddingY + q.size / 2));
|
||||||
|
|
||||||
|
cairo_rectangle(cr, q.x + paddingX, q.y + paddingY, q.size, q.size);
|
||||||
|
|
||||||
cairo_scale(cr, scaleX, scaleY);
|
cairo_scale(cr, scaleX, scaleY);
|
||||||
|
|
||||||
gdk_cairo_set_source_pixbuf(cr, m_Pixbuf, q.x, (q.y + m_Padding) * (1.f / scaleY));
|
gdk_cairo_set_source_pixbuf(cr, m_Pixbuf, (q.x + paddingX) * (1.0 / scaleY), (q.y + paddingY) * (1.0 / scaleY));
|
||||||
cairo_fill(cr);
|
cairo_fill(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue