VirtualBox

Changeset 104908 in vbox


Ignore:
Timestamp:
Jun 13, 2024 10:29:10 AM (11 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163510
Message:

FE/Qt. bugref:9510. Don't raw CPU graphs stacked since this messes up colors when we use translucency,

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp

    r104642 r104908  
    517517    const float fPenWidth = 1.5f;
    518518    const float fPointSize = 3.5f;
    519     QPixmap areaPixmap(width(), height());
    520     if (m_fUseAreaChart && m_fIsAreaChartAllowed)
    521         areaPixmap.fill(QColor(0, 0, 0, 0));
    522519    for (int k = 0; k < DATA_SERIES_SIZE; ++k)
    523520    {
     
    534531        if (m_fUseAreaChart && m_fIsAreaChartAllowed)
    535532        {
    536             QPainter pixmapPainter(&areaPixmap);
    537533            QVector<QPointF> points;
    538             for (int i = 0; i < data->size(); ++i)
     534            /* Create two polygons. Polygon of data series 0 is on top of the one of 1st data series: */
     535            /* We add the points to vector in counter clockwise fashion: */
     536            if (k == 0)
    539537            {
    540                 float fHeight = fH * data->at(i);
    541                 /* Stack 0th data series on top of the 1st data series: */
    542                 if (k == 0)
     538                for (int i = 0; i < data->size(); ++i)
    543539                {
     540                    float fX = (width() - m_iMarginRight) - ((data->size() - i - 1) * fBarWidth);
     541                    float fHeight = fH * data->at(i);
    544542                    if (m_pMetric->data(1) && m_pMetric->data(1)->size() > i)
    545543                        fHeight += fH * m_pMetric->data(1)->at(i);
     544                    points << QPointF(fX, height() - (fHeight + m_iMarginBottom));
    546545                }
    547                 float fX = (width() - m_iMarginRight) - ((data->size() - i - 1) * fBarWidth);
    548                 if (i == 0)
    549                     points << QPointF(fX, height() - m_iMarginBottom);
    550                 points << QPointF(fX, height() - (fHeight + m_iMarginBottom));
    551                 if (i == data->size() - 1)
    552                     points << QPointF(fX, height() - + m_iMarginBottom);
     546                for (int i = data->size() - 1; i >= 0; --i)
     547                {
     548                    float fX = (width() - m_iMarginRight) - ((data->size() - i - 1) * fBarWidth);
     549                    float fHeight = 0;
     550                    if (m_pMetric->data(1) && m_pMetric->data(1)->size() > i)
     551                        fHeight = fH * m_pMetric->data(1)->at(i);
     552                    points << QPointF(fX, height() - (fHeight + m_iMarginBottom));
     553                }
    553554            }
    554             pixmapPainter.setPen(Qt::NoPen);
    555             QColor fillColor(m_dataSeriesColor[k]);
    556             pixmapPainter.setBrush(fillColor);
    557             pixmapPainter.drawPolygon(points, Qt::WindingFill);
     555            else if (k == 1)
     556            {
     557                for (int i = 0; i < data->size(); ++i)
     558                {
     559                    float fHeight = fH * data->at(i);
     560                    float fX = (width() - m_iMarginRight) - ((data->size() - i - 1) * fBarWidth);
     561                    if (i == 0)
     562                        points << QPointF(fX, height() - m_iMarginBottom);
     563                    points << QPointF(fX, height() - (fHeight + m_iMarginBottom));
     564                    if (i == data->size() - 1)
     565                        points << QPointF(fX, height() - + m_iMarginBottom);
     566                }
     567            }
     568            painter.setOpacity(0.6);
     569            painter.setPen(Qt::NoPen);
     570            painter.setBrush(m_dataSeriesColor[k]);
     571            painter.drawPolygon(points, Qt::WindingFill);
     572            painter.setOpacity(1.0);
    558573        }
    559574        else
     
    586601        if (m_fUseAreaChart && m_fIsAreaChartAllowed)
    587602        {
    588             painter.setOpacity(0.5);
    589             painter.drawImage(rect(), areaPixmap.toImage());
    590             painter.setOpacity(1.0);
     603            // painter.setOpacity(0.5);
     604            // painter.drawImage(rect(), areaPixmap.toImage());
     605            // painter.setOpacity(1.0);
    591606        }
    592607        /* Draw a horizontal and vertical line on data point under the mouse cursor
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette