summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-01 16:20:28 (UTC)
committer sandman <sandman>2002-10-01 16:20:28 (UTC)
commit3352558f31f2f3f5f32730a28f07161fe71787a9 (patch) (side-by-side diff)
tree613a75fb333cfd28f54e29cd2b420889ea4467f0
parent70d2cbd97a6b39b1738e3e6580f916dcf0fbc787 (diff)
downloadopie-3352558f31f2f3f5f32730a28f07161fe71787a9.zip
opie-3352558f31f2f3f5f32730a28f07161fe71787a9.tar.gz
opie-3352558f31f2f3f5f32730a28f07161fe71787a9.tar.bz2
Another performance tweak for busyindicator and alpha-blended bg pixmaps
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 33717bc..e15b150 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -131,42 +131,42 @@ public:
int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100;
int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100;
int ai = qAlpha ( *rgb );
*rgb = qRgba ( ri, gi, bi, ai );
}
bpm [i].convertFromImage( img );
}
busystate = 0;
if ( busytimer )
killTimer ( busytimer );
timerEvent ( 0 );
- busytimer = startTimer ( 180 );
+ busytimer = startTimer ( 200 );
}
else {
killTimer ( busytimer );
busytimer = 0;
}
}
}
virtual void timerEvent ( QTimerEvent *te )
{
if ( !te || ( te-> timerId ( ) == busytimer )) {
if ( bsy ) {
busystate++;
if ( busystate > 5 )
busystate = -4;
- bsy-> repaint ( );
+ QScrollView::updateContents ( bsy-> pixmapRect ( false ));
}
}
}
bool inKeyEvent() const { return ike; }
void keyPressEvent(QKeyEvent* e)
{
ike = TRUE;
if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space )
returnPressed(currentItem());
QIconView::keyPressEvent(e);
ike = FALSE;
@@ -193,35 +193,49 @@ public:
// cats.replace(*cit,(void*)1);
// }
QString maj=app->type();
int sl=maj.find('/');
if (sl>=0) {
QString k;
k = maj.left(12) == "application/" ? maj : maj.left(sl);
mimes.replace(k,(void*)1);
}
}
void setBackgroundPixmap( const QPixmap &pm ) {
- bgPixmap = pm;
+ if ( pm. isNull ( )) {
+ bgPixmap = pm;
+ }
+ else {
+ // This is need for bg images with alpha channel
+
+ QPixmap tmp ( pm. size ( ), pm. depth ( ));
+
+ QPainter p ( &tmp );
+ p. fillRect ( 0, 0, pm. width ( ), pm. height ( ), bgColor. isValid ( ) ? bgColor : white );
+ p. drawPixmap ( 0, 0, pm );
+ p. end ( );
+
+ bgPixmap = tmp;
+ }
}
void setBackgroundColor( const QColor &c ) {
bgColor = c;
}
void drawBackground( QPainter *p, const QRect &r )
{
if ( !bgPixmap.isNull() ) {
- p-> fillRect ( r, bgColor );
+ //p-> fillRect ( r, bgColor );
p->drawTiledPixmap( r, bgPixmap,
QPoint( (r.x() + contentsX()) % bgPixmap.width(),
(r.y() + contentsY()) % bgPixmap.height() ) );
} else {
p->fillRect( r, bgColor );
}
}
void setItemTextPos( ItemTextPos pos )
{
calculateGrid( pos );
QIconView::setItemTextPos( pos );