void HUDSlider::draw(GraphicsContext& context) { // Draw gutter IntSize radius(m_rect.height() / 2, m_rect.height() / 2); context.fillRoundedRect(FloatRoundedRect(m_rect, radius, radius, radius, radius), Color(sliderGutterColor), ColorSpaceDeviceRGB); // Draw button context.setStrokeColor(Color(sliderButtonColor), ColorSpaceDeviceRGB); context.setFillColor(Color(sliderButtonColor), ColorSpaceDeviceRGB); if (m_buttonShape == RoundButton) { context.drawEllipse(IntRect(m_rect.location().x() + m_buttonPosition, m_rect.location().y() - (m_buttonSize - m_rect.height()) / 2, m_buttonSize, m_buttonSize)); return; } // Draw a diamond FloatPoint points[4]; float half = static_cast<float>(m_buttonSize) / 2; points[0].setX(m_rect.location().x() + m_buttonPosition + half); points[0].setY(m_rect.location().y()); points[1].setX(m_rect.location().x() + m_buttonPosition + m_buttonSize); points[1].setY(m_rect.location().y() + half); points[2].setX(m_rect.location().x() + m_buttonPosition + half); points[2].setY(m_rect.location().y() + m_buttonSize); points[3].setX(m_rect.location().x() + m_buttonPosition); points[3].setY(m_rect.location().y() + half); context.drawConvexPolygon(4, points, true); }