- m_currently_filled = eRect(0, 0, num_pix, size().height());
+
+ int pixsize = (m_orientation == orHorizontal) ? size().width() : size().height();
+
+ if (m_min < m_max)
+ {
+ num_pix = pixsize * (m_value - m_start) / (m_max - m_min);
+ start_pix = pixsize * m_start / (m_max - m_min);
+ }
+
+ if (start_pix < 0)
+ {
+ num_pix += start_pix;
+ start_pix = 0;
+ }
+
+ if (num_pix < 0)
+ num_pix = 0;
+
+ if (m_orientation == orHorizontal)
+ m_currently_filled = eRect(start_pix, 0, num_pix, size().height());
+ else
+ m_currently_filled = eRect(0, start_pix, size().width(), num_pix);