[mythtv] Slow menu drawing

James Knight foom at fuhm.net
Sat Mar 29 13:48:58 EST 2003


So, the change to fix the slow menu option drawing worked really well. 
Now the options draw instantly. However, there is still one problem 
left - the mythTV banner still takes ~0.5sec to draw.

Well, I looked at the code, and figured out that 	the problem was that 
paintTitle and paintLogo still use the slowwwwww "pix.fill(this, 
rect);" call which was removed from the button drawing code with great 
results.

Now, I know nothing at all about QT code (this is the first time I've 
ever looked at QT code), but it seems to me that nearly that whole 
function is redundant. It creates a pixmap, copies the background into 
it, draws the new foreground over the copied background, and then 
finally, copies that composited image back into the passed in Painter. 
Why not simply just draw the new foreground pixmap directly to the 
passed-in Painter?

Well, eliminating all the stuff which looked redundant *appears* to 
work right and speed up the drawing a whole lot, so here's a patch.

As I said, I know nothing about QT so if this does something horribly 
wrong, please tell me nicely. :)

James

Index: themedmenu.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/themedmenu.cpp,v
retrieving revision 1.30
diff -r1.30 themedmenu.cpp
1070,1082c1070
<     {
<         QPixmap pix(logoRect.size());
<         pix.fill(this, logoRect.topLeft());
<
<         QPainter tmp;
<         tmp.begin(&pix, this);
<
<         tmp.drawPixmap(0, 0, *logo);
<
<         tmp.end();
<
<         p->drawPixmap(logoRect.topLeft(), pix);
<     }
---
 >         p->drawPixmap(logoRect.topLeft(), *logo);
1088,1100c1076
<     {
<         QPixmap pix(titleRect.size());
<         pix.fill(this, titleRect.topLeft());
<
<         QPainter tmp;
<         tmp.begin(&pix, this);
<
<         tmp.drawPixmap(0, 0, *curTitle);
<
<         tmp.end();
<
<         p->drawPixmap(titleRect.topLeft(), pix);
<     }
---
 >         p->drawPixmap(titleRect.topLeft(), *curTitle);



More information about the mythtv-dev mailing list