Hi,

I get an exception in the attached testcase (the code is from KDE's 
Oxygen style). This is on Linux.


Cheers,
André


-- 
Dipl.-Math. André Wöbbeking

Ingenieurgesellschaft für Verkehrs- und Eisenbahnwesen mbH
Consulting Company for Traffic and Railway Engineering Ltd.

Vahrenwalder Platz 3
30165 Hannover
Germany

phone: +49 511 984228 - 10
fax:   +49 511 984228 - 29
web:   www.ivembh.de
email: [email protected]

Rechtsform: Gesellschaft mit beschränkter Haftung
Sitz des Unternehmens: Hannover
Amtsgericht Hannover, HRB 56965

Geschäftsführer:
Prof. Dr.-Ing. Thomas Siefer
PD Dr.-Ing. Alfons Radtke
#include <QtGui>

#include <cfloat>

#if defined Q_OS_WIN32

void fp_setup()
{
    // Activate all FPU-Exceptions
    unsigned int uiStateFPU = 0;
    __control87_2(0, _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW, &uiStateFPU, 0);

    // Activate all SSE-Exceptions
    unsigned int uiStateSSE = 0;
    __control87_2(0, _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW, 0, &uiStateSSE);
    _clearfp();
}

#else

#include <fenv.h>

void fp_setup()
{
  int iActiveExceptions = FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID;
  feclearexcept(FE_ALL_EXCEPT);
  feenableexcept(iActiveExceptions);
}

#endif



QColor alphaColor(QColor color, double alpha)
{
    if (alpha >= 1.0)
        return color;
    color.setAlphaF(qMax(0.0, alpha) * color.alphaF());
    return color;
}



int main(int argc, char *argv[])
{
    fp_setup();

    QApplication app(argc, argv);

    const int size(21), rsize(21);
    const QColor color(Qt::blue);

    QPixmap pixmap(rsize, rsize);
    pixmap.fill(QColor(0,0,0,0));

    QPainter p(&pixmap);
    p.setRenderHints(QPainter::Antialiasing);
    p.setPen(Qt::NoPen);
    p.setWindow(0,0,size,size);

    QRectF r(0, 0, size, size);
    double m = double(size)*0.5;

    const double width = 3.0;
    const double bias = 0.9 * double(size) / double(rsize);
    double k0 = (m-width+bias) / m;
    QRadialGradient glowGradient(m, m, m);
    for (int i = 0; i < 8; i++) {
        double k1 = (k0 * double(8 - i) + double(i)) * 0.125;
        double a = 1.0 - sqrt(i * 0.125);
        glowGradient.setColorAt(k1, alphaColor(color, a));
    }
    glowGradient.setColorAt(1.0, alphaColor(color, 0.0));

    p.setBrush(glowGradient);
    p.drawEllipse(r);


    return app.exec();
}
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to