[Panel-devel] Patch to cache standard applet background background

Zack Rusin zack at kde.org
Sun Jul 29 21:31:38 CEST 2007


On Sunday 29 July 2007 12:24:11 pm Thomas Georgiou wrote:
> I reworked the background caching without the shadows and made big
> improvements to it thanks to the help of people on this mailing list.

cool, just some small comments.

+        if (cachedBackground || cachedBackground->size() != QSize(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight)) {

I don't think this part works.
if (pointerIsValid || invalidPointer->size() != QSize(...))
:)
I guess cachedBackground is always valid.

+            if (!cachedBackground) {
+                delete cachedBackground;
+            }

the "if" part is redundant. delete cachedBackground by itself is ok.

+        p2->drawPixmap(leftOffset, topOffset, *cachedBackground);

this part works by accident (if at all :) ). you open a painter on a pixmap,
render to it and then try to use the pixmap without ending the painter. 
that means the pixmap is in an undefined state when you use it. remember
that you must add a p.end(); call in the section where you render to
cachedBackground.
 
z


More information about the Panel-devel mailing list