VirtualBox

Changeset 81508 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 24, 2019 6:39:40 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9510. Drawing doughnut with a bit darker color.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationPerformanceMonitor.cpp

    r81411 r81508  
    9696    void setIsAreaChartAllowed(bool fIsAreaChartAllowed);
    9797
    98     QColor dataSeriesColor(int iDataSeriesIndex);
     98    QColor dataSeriesColor(int iDataSeriesIndex, int iDark = 0);
    9999    void setDataSeriesColor(int iDataSeriesIndex, const QColor &color);
    100100
     
    125125       void drawDoughnutChart(QPainter &painter, quint64 iMaximum, int iDataIndex,
    126126                              const QRectF &chartRect, const QRectF &innerRect);
     127       /** Draws a doughnut shaped shart for two data series combines. the 2nd data is added on top of 1st. */
    127128       void drawCombinedDoughnutChart(QPainter &painter, quint64 iMaximum,
    128129                                      const QRectF &chartRect, const QRectF &innerRect);
     
    267268}
    268269
    269 QColor UIChart::dataSeriesColor(int iDataSeriesIndex)
     270QColor UIChart::dataSeriesColor(int iDataSeriesIndex, int iDark /* = 0 */)
    270271{
    271272    if (iDataSeriesIndex >= DATA_SERIES_SIZE)
    272273        return QColor();
    273     return m_dataSeriesColor[iDataSeriesIndex];
     274    return QColor(qMax(m_dataSeriesColor[iDataSeriesIndex].red() - iDark, 0),
     275                  qMax(m_dataSeriesColor[iDataSeriesIndex].green() - iDark, 0),
     276                  qMax(m_dataSeriesColor[iDataSeriesIndex].blue() - iDark, 0),
     277                  m_dataSeriesColor[iDataSeriesIndex].alpha());
    274278}
    275279
     
    473477    if (!m_pMetric)
    474478        return;
    475     /* First draw a doughnut shaped chart for the 1st data series */
     479
    476480    const QQueue<quint64> *data = m_pMetric->data(iDataIndex);
    477481    if (!data || data->isEmpty())
     
    514518    painter.drawArc(innerRect, 0, 3600 * 16);
    515519
    516     /* Draw a white filled circle and that the arc for data: */
     520    /* Draw a white filled circle and the arc for data: */
    517521    QPainterPath background = wholeArc(chartRect).subtracted(wholeArc(innerRect));
    518522    painter.setPen(Qt::NoPen);
     
    547551    /* Draw a doughnut slice for the first data series: */
    548552    float fAngle = 360.f * data->back() / (float)iMaximum;
    549     painter.setBrush(m_dataSeriesColor[iDataIndex]);
     553    painter.setBrush(dataSeriesColor(iDataIndex, 50));
    550554    painter.drawPath(doughnutSlice(chartRect, innerRect, 90, fAngle));
    551555
     
    556560    {
    557561        float fAngle2 = 360.f * data2->back() / (float)iMaximum;
    558         painter.setBrush(m_dataSeriesColor[iDataIndex]);
     562        painter.setBrush(dataSeriesColor(iDataIndex, 50));
    559563        painter.drawPath(doughnutSlice(chartRect, innerRect, 90 - fAngle, fAngle2));
    560564    }
Note: See TracChangeset for help on using the changeset viewer.

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