void CpuWidget::setDisplayMode(const drawMode mode) { m_displayMode = mode; switch (m_displayMode) { case 0: { setPainter(m_barsP); break; } case 1: { setPainter(m_graphP); break; } case 2: { setPainter(m_multiP); break; } } }
void View::pdraw(QPainter& p, const QRect& r) { //printf("View::pdraw virt:%d x:%d width:%d y:%d height:%d\n", virt(), r.x(), r.width(), r.y(), r.height()); if (virt()) { setPainter(p); int x = r.x(); int y = r.y(); int w = r.width(); int h = r.height(); if (xmag <= 0) { // TODO These adjustments are required, otherwise gaps. Tried, unable to remove them for now. p4.0.30 x -= 1; w += 2; //x = (x + xpos + rmapx(xorg)) * (-xmag); x = lrint((double(x + xpos) + rmapx_f(xorg)) * double(-xmag)); w = w * (-xmag); } else { //x = (x + xpos + rmapx(xorg)) / xmag; x = lrint((double(x + xpos) + rmapx_f(xorg)) / double(xmag)); //w = (w + xmag - 1) / xmag; w = lrint(double(w) / double(xmag)); x -= 1; w += 2; } if (ymag <= 0) { y -= 1; h += 2; //y = (y + ypos + rmapy(yorg)) * (-ymag); y = lrint((double(y + ypos) + rmapy_f(yorg)) * double(-ymag)); h = h * (-ymag); } else { //y = (y + ypos + rmapy(yorg)) / ymag; y = lrint((double(y + ypos) + rmapy_f(yorg)) / double(ymag)); //h = (h + ymag - 1) / ymag; h = lrint(double(h) / double(ymag)); y -= 1; h += 2; } if (x < 0) x = 0; if (y < 0) y = 0; draw(p, QRect(x, y, w, h)); } else draw(p, r); }