From 493224966e5ac65312cae5e690e47ce6788a18d4 Mon Sep 17 00:00:00 2001 From: Cristian Tibirna Date: Tue, 3 Aug 1999 01:53:18 +0000 Subject: [PATCH] CT: use kpixmapeffect intensity method for fading. I say, semi-empirically, it's about 5 times faster than before. svn path=/trunk/kdebase/konsole/; revision=26934 --- src/rootBg.C | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/rootBg.C b/src/rootBg.C index da598c11..5f8d41c6 100644 --- a/src/rootBg.C +++ b/src/rootBg.C @@ -38,6 +38,7 @@ #include "rootBg.h" #include #include +#include // By default, when you assign a background to your widget, the pixmap has @@ -591,6 +592,16 @@ void RootPixmap::generateBackground(double r, double g, double b) generateBackground(true,r,g,b); } +/* This is the original code of Antonion + The code I (CT) used to replace this is Mosfet's intensity effect. + + For some reason, when doing tests with kdelibs/kdetest/kcolortest, I can't + see significant delay differences. + + Anyways, for whatever reason, the KPixmapEffect::intensity method is *much* + faster in real-work test with Konsole (I compared changing sizes of + konsole by using Size menu) + void RootPixmap::shadePixmap(QPixmap *pm, double r, double g, double b) { QImage qimg=pm->convertToImage(); @@ -609,6 +620,18 @@ void RootPixmap::shadePixmap(QPixmap *pm, double r, double g, double b) pm->convertFromImage(qimg); } +*/ + +// new fading method - much faster (CT 02Aug1999) +void RootPixmap::shadePixmap(QPixmap *pm, double r, double g, double b) +{ + //use Mosfet's channelIntensity effects + QImage tmp = pm->convertToImage(); + KPixmapEffect::channelIntensity(tmp, (float)r, KPixmapEffect::Red, false); + KPixmapEffect::channelIntensity(tmp, (float)g, KPixmapEffect::Green, false); + KPixmapEffect::channelIntensity(tmp, (float)b, KPixmapEffect::Blue, false); + pm->convertFromImage(tmp); +} void RootPixmap::shadeColor(QColor *color, double r, double g, double b) {