]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/qte/qte-2.3.10/qiconview-speed.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / qte / qte-2.3.10 / qiconview-speed.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 --- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp~qiconview-speed
7 +++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp
8 @@ -225,6 +225,7 @@
9      QIconView::SelectionMode selectionMode;
10      QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor;
11      QRect *rubber;
12 +    QPixmap *backBuffer;
13      QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer,
14         *fullRedrawTimer;
15      int rastX, rastY, spacing;
16 @@ -2268,6 +2269,7 @@
17      d->currentItem = 0;
18      d->highlightedItem = 0;
19      d->rubber = 0;
20 +    d->backBuffer = 0;
21      d->scrollTimer = 0;
22      d->startDragItem = 0;
23      d->tmpCurrentItem = 0;
24 @@ -2416,6 +2418,8 @@
25         delete item;
26         item = tmp;
27      }
28 +    delete d->backBuffer;
29 +    d->backBuffer = 0;
30      delete d->fm;
31      d->fm = 0;
32  #ifndef QT_NO_TOOLTIP
33 @@ -2882,6 +2886,48 @@
34  }
35  
36  /*!
37 +    This function grabs all paintevents that otherwise would have been
38 +    processed by the QScrollView::viewportPaintEvent(). Here we use a
39 +    doublebuffer to reduce 'on-paint' flickering on QIconView
40 +    (and of course its childs).
41 +
42 +    \sa QScrollView::viewportPaintEvent(), QIconView::drawContents()
43 +*/
44 +
45 +void QIconView::bufferedPaintEvent( QPaintEvent* pe )
46 +{
47 +    QWidget* vp = viewport();
48 +    QRect r = pe->rect() & vp->rect();
49 +    int ex = r.x() + contentsX();
50 +    int ey = r.y() + contentsY();
51 +    int ew = r.width();
52 +    int eh = r.height();
53 +
54 +    if ( !d->backBuffer )
55 +       d->backBuffer = new QPixmap(vp->size());
56 +    if ( d->backBuffer->size() != vp->size() ) {
57 +       //Resize function (with hysteesis). Uses a good compromise between memory
58 +       //consumption and speed (number) of resizes.
59 +        float newWidth = (float)vp->width();
60 +       float newHeight = (float)vp->height();
61 +       if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() )
62 +       {
63 +           newWidth *= 1.1892;
64 +           newHeight *= 1.1892;
65 +           d->backBuffer->resize( (int)newWidth, (int)newHeight );
66 +       } else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() )
67 +           d->backBuffer->resize( (int)newWidth, (int)newHeight );
68 +    }
69 +
70 +    QPainter p;
71 +    p.begin(d->backBuffer, vp);
72 +    drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh);
73 +    p.end();
74 +    bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh);
75 +}
76 +
77 +/*!
78 +
79    \reimp
80  */
81  
82 @@ -4939,7 +4985,7 @@
83                 if ( !d->rubber )
84                     drawDragShapes( d->oldDragPos );
85             }
86 -           viewportPaintEvent( (QPaintEvent*)e );
87 +            bufferedPaintEvent ((QPaintEvent*)e );
88             if ( d->dragging ) {
89                 if ( !d->rubber )
90                     drawDragShapes( d->oldDragPos );
91 @@ -5377,11 +5423,19 @@
92         return;
93  
94      if ( item->d->container1 && d->firstContainer ) {
95 -       item->d->container1->items.removeRef( item );
96 +       //Special-case checking of the last item, since this may be
97 +       //called a few times for the same item.
98 +        if (item->d->container1->items.last() == item)
99 +            item->d->container1->items.removeLast();
100 +        else
101 +            item->d->container1->items.removeRef( item );
102      }
103      item->d->container1 = 0;
104      if ( item->d->container2 && d->firstContainer ) {
105 -       item->d->container2->items.removeRef( item );
106 +        if (item->d->container2->items.last() == item)
107 +            item->d->container2->items.removeLast();
108 +        else
109 +            item->d->container2->items.removeRef( item );
110      }
111      item->d->container2 = 0;
112  
113 --- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h~qiconview-speed
114 +++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h
115 @@ -444,6 +444,7 @@
116      virtual void contentsDropEvent( QDropEvent *e );
117  #endif
118  
119 +    void bufferedPaintEvent( QPaintEvent* );
120      virtual void resizeEvent( QResizeEvent* e );
121      virtual void keyPressEvent( QKeyEvent *e );
122      virtual void focusInEvent( QFocusEvent *e );