Author: coolo Date: Wed Jan 16 12:18:45 2008 New Revision: 43654 URL: http://svn.opensuse.org/viewcvs/yast?rev=43654&view=rev Log: some caching Modified: trunk/qt/src/QY2Styler.cc trunk/qt/src/YQUI_core.cc Modified: trunk/qt/src/QY2Styler.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2Styler.cc?rev=43654&r1=43653&r2=43654&view=diff ============================================================================== --- trunk/qt/src/QY2Styler.cc (original) +++ trunk/qt/src/QY2Styler.cc Wed Jan 16 12:18:45 2008 @@ -8,6 +8,7 @@ #include <QSvgRenderer> #include <QDebug> #include <iostream> +#include <QPixmapCache> using namespace std; @@ -16,6 +17,7 @@ QY2Styler::QY2Styler( QObject *parent ) : QObject( parent ) { + QPixmapCache::setCacheLimit( 5 * 1024 ); _self = this; } @@ -104,9 +106,17 @@ QPainter pain( &result ); if ( !_backgrounds[ name ].filename.endsWith( ".svg" ) ) { - qDebug() << "scale " << qPrintable( name ) << " " << fillRect.width() << " " << fillRect.height(); - QImage scaled = _backgrounds[name].pix.scaled( fillRect.width(), fillRect.height() ); - pain.drawImage( fillRect.topLeft(), scaled, QRectF(QPointF(0,0), scaled.size()), Qt::OrderedAlphaDither); + QString key = QString( "style_%1_%2_%3" ).arg( name ).arg( fillRect.width() ).arg( fillRect.height() ); + QPixmap scaled; + if ( QPixmapCache::find( key, scaled ) ) + { + qDebug() << "found " << qPrintable( key ); + } else { + qDebug() << "scale " << qPrintable( name ) << " " << fillRect.width() << " " << fillRect.height(); + scaled = QPixmap::fromImage( _backgrounds[name].pix.scaled( fillRect.width(), fillRect.height() ) ); + QPixmapCache::insert( key, scaled ); + } + pain.drawPixmap( fillRect.topLeft(), scaled ); } else { #if 0 QSvgRenderer rend( _backgroundFn[ name ] ); Modified: trunk/qt/src/YQUI_core.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=43654&r1=43653&r2=43654&view=diff ============================================================================== --- trunk/qt/src/YQUI_core.cc (original) +++ trunk/qt/src/YQUI_core.cc Wed Jan 16 12:18:45 2008 @@ -93,6 +93,9 @@ if (_ui_inited) return; + // yast has no use of the glib event loop + setenv( "QT_NO_GLIB", "1", 1 ); + _ui_inited = true; new QApplication( _ui_argc, _ui_argv); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org