[mythtv] Slow menu drawing

John Danner johndanner at untzuntz.com
Sat Mar 29 14:09:13 EST 2003



> Why not simply just draw the new foreground pixmap directly to the passed-
in Painter

You need to copy the background pixmap into the object you are painting onto 
which is what the .fill does. Then you draw the pixmap on top of the 
background, then draw that entire pixmap back to the screen.

Without the fill there will just be a black background <- or maybe the 
window's background color if it is set.

Was that nice enough? :)

-John

---------- Original Message -----------
From: James Knight <foom at fuhm.net>
To: mythtv-dev at snowman.net
Sent: Sat, 29 Mar 2003 13:48:58 -0500
Subject: [mythtv] Slow menu drawing

> 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);
> 
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at snowman.net
> http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-dev
------- End of Original Message -------



More information about the mythtv-dev mailing list