[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui/colors
From: Christoph Feck <christoph () maxiom ! de>
Date: 2010-05-01 15:25:19
Message-ID: 20100501152519.B8209AC8AA () svn ! kde ! org
[Download RAW message or body]
SVN commit 1121524 by cfeck:
Use pixmap scaling for interpolation
This avoids calls to setHsv() for every pixel and is faster.
M +22 -9 khuesaturationselect.cpp
--- trunk/KDE/kdelibs/kdeui/colors/khuesaturationselect.cpp #1121523:1121524
@@ -162,7 +162,18 @@
void KHueSaturationSelector::drawPalette( QPixmap *pixmap )
{
- int xSize = contentsRect().width(), ySize = contentsRect().height();
+ int xSize, ySize = 2;
+ switch (chooserMode()) {
+ case ChooserClassic:
+ case ChooserSaturation:
+ case ChooserValue:
+ xSize = 7;
+ break;
+ default:
+ xSize = 2;
+ break;
+ }
+
QImage image( QSize( xSize, ySize ), QImage::Format_RGB32 );
QColor col;
int h, s;
@@ -209,14 +220,16 @@
}
}
- /*
- if ( pixmap->depth() <= 8 )
- {
- const QVector<QColor> standardPalette = kdeui_standardPalette();
- KImageEffect::dither( image, standardPalette.data(), standardPalette.size() );
+ QPixmap pix(contentsRect().size());
+ QPainter painter(&pix);
+ // Bilinear filtering
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+ QRectF srcRect(0.5, 0.5, xSize - 1, ySize - 1);
+ QRectF destRect(QPointF(0, 0), contentsRect().size());
+ painter.drawImage(destRect, image, srcRect);
+ painter.end();
+
+ *pixmap = pix;
}
- */
- *pixmap = QPixmap::fromImage( image );
-}
#include "khuesaturationselect.moc"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic