[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: KDE/kdelibs/kdeui/icons
From: Carlo <brandon.ml () gmail ! com>
Date: 2009-07-17 9:09:47
Message-ID: 3262b6180907170209o3ee132f6p8ba32110ee92e9c9 () mail ! gmail ! com
[Download RAW message or body]
On Fri, Jul 17, 2009 at 10:47 AM, David Faure<faure@kde.org> wrote:
> On Friday 17 July 2009, Carlo Segato wrote:
> > SVN commit 998111 by segato:
> >
> > apparently QApplication::desktop()->paintEngine() is null on windows, so the \
> > check for antialiasing support fails even if we support it(or at least I hope \
> > so), this way we can have smooth icons effects on windows too
> >
> > M +10 -1 kiconeffect.cpp
> >
> >
> > --- trunk/KDE/kdelibs/kdeui/icons/kiconeffect.cpp #998110:998111
> > @@ -505,8 +505,10 @@
> > int width = img.width();
> > int height = img.height();
> >
> > +#ifndef Q_WS_WIN
> > QPaintEngine* pe = QApplication::desktop()->paintEngine();
> > if(pe && pe->hasFeature(QPaintEngine::Antialiasing)){
> > +#endif
> > unsigned char *line;
> > for(y=0; y<height; y++){
> > if(QSysInfo::ByteOrder == QSysInfo::BigEndian)
> > @@ -518,6 +520,7 @@
> > line += 4;
> > }
> > }
> > +#ifndef Q_WS_WIN
> > }
> > else{
> > for(y=0; y<height; y++){
> > @@ -526,11 +529,15 @@
> > line[x] &= 0x00ffffff;
> > }
> > }
> > +#endif
> > }
> > else{
> > if (img.depth() == 8) {
> > +#ifndef Q_WS_WIN
> > QPaintEngine *pe = QApplication::desktop()->paintEngine();
> > - if (pe && pe->hasFeature(QPaintEngine::Antialiasing)) {
> > + if (pe && pe->hasFeature(QPaintEngine::Antialiasing))
> > +#endif
> > + {
> > // not running on 8 bit, we can safely install a new colorTable
> > QVector<QRgb> colorTable = img.colorTable();
> > for (int i = 0; i < colorTable.size(); ++i) {
> > @@ -595,7 +602,9 @@
> >
> > void KIconEffect::semiTransparent(QPixmap &pix)
> > {
> > +#ifndef Q_WS_WIN
> > if (QApplication::desktop()->paintEngine() && \
> > QApplication::desktop()->paintEngine()->hasFeature(QPaintEngine::Antialiasing)) \
> > +#endif
>
> This code would be cleaner with a helper static function
>
> static bool painterSupportsAntialiasing()
> {
> #ifndef Q_WS_WIN
> // apparently QApplication::desktop()->paintEngine() is null on windows
> // but we can assume the paint engine supports antialiasing there, right?
> return true;
> #else
> QPaintEngine* const pe = QApplication::desktop()->paintEngine();
> return pe && pe->hasFeature(QPaintEngine::Antialiasing);
> #endif
> }
>
> This way the logic is in a single place and can be changed more easily,
> and the "hack" is documented, making the code more understandable
> (and fixable, if necessary).
>
> --
> David Faure, faure@kde.org, sponsored by Qt Software @ Nokia to work on KDE,
> Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
>
thanks, I just commited it
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic