Diffstat (limited to 'qt/qt-2.3.7.patch/qte237-iconviewspeed.patch') (more/less context) (show whitespace changes)
-rw-r--r-- | qt/qt-2.3.7.patch/qte237-iconviewspeed.patch | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch b/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch index 63e45ec..81064e1 100644 --- a/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch +++ b/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch | |||
@@ -1,117 +1,110 @@ | |||
1 | Speed up patches backported from | 1 | Speed up patches backported from |
2 | 2 | ||
3 | http://robotics.dei.unipd.it/~koral/KDE/kflicker.html | 3 | http://robotics.dei.unipd.it/~koral/KDE/kflicker.html |
4 | 4 | ||
5 | and | 5 | and |
6 | 6 | ||
7 | http://lists.kde.org/?l=kde-optimize&m=105382164111363&w=2 (complete thread) | 7 | http://lists.kde.org/?l=kde-optimize&m=105382164111363&w=2 (complete thread) |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | diff -u qt-2.3.7_old/src/iconview/qiconview.cpp qt-2.3.7/src/iconview/qiconview.cpp | 12 | diff -u qt-2.3.7_old/src/iconview/qiconview.cpp qt-2.3.7/src/iconview/qiconview.cpp |
13 | --- qt-2.3.7_old/src/iconview/qiconview.cpp2004-06-13 22:29:56.000000000 +0200 | 13 | --- qt-2.3.7_old/src/iconview/qiconview.cpp2004-06-13 22:29:56.000000000 +0200 |
14 | +++ qt-2.3.7/src/iconview/qiconview.cpp2004-06-13 22:33:32.000000000 +0200 | 14 | +++ qt-2.3.7/src/iconview/qiconview.cpp2004-06-13 22:33:32.000000000 +0200 |
15 | @@ -1,5 +1,5 @@ | ||
16 | /**************************************************************************** | ||
17 | -** $Id$ | ||
18 | +** $Id$ | ||
19 | ** | ||
20 | ** Implementation of QIconView widget class | ||
21 | ** | ||
22 | @@ -220,6 +220,7 @@ | 15 | @@ -220,6 +220,7 @@ |
23 | QIconView::SelectionMode selectionMode; | 16 | QIconView::SelectionMode selectionMode; |
24 | QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor; | 17 | QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor; |
25 | QRect *rubber; | 18 | QRect *rubber; |
26 | + QPixmap *backBuffer; | 19 | + QPixmap *backBuffer; |
27 | QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer, | 20 | QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer, |
28 | *fullRedrawTimer; | 21 | *fullRedrawTimer; |
29 | int rastX, rastY, spacing; | 22 | int rastX, rastY, spacing; |
30 | @@ -2263,6 +2264,7 @@ | 23 | @@ -2263,6 +2264,7 @@ |
31 | d->currentItem = 0; | 24 | d->currentItem = 0; |
32 | d->highlightedItem = 0; | 25 | d->highlightedItem = 0; |
33 | d->rubber = 0; | 26 | d->rubber = 0; |
34 | + d->backBuffer = 0; | 27 | + d->backBuffer = 0; |
35 | d->scrollTimer = 0; | 28 | d->scrollTimer = 0; |
36 | d->startDragItem = 0; | 29 | d->startDragItem = 0; |
37 | d->tmpCurrentItem = 0; | 30 | d->tmpCurrentItem = 0; |
38 | @@ -2411,6 +2413,8 @@ | 31 | @@ -2411,6 +2413,8 @@ |
39 | delete item; | 32 | delete item; |
40 | item = tmp; | 33 | item = tmp; |
41 | } | 34 | } |
42 | + delete d->backBuffer; | 35 | + delete d->backBuffer; |
43 | + d->backBuffer = 0; | 36 | + d->backBuffer = 0; |
44 | delete d->fm; | 37 | delete d->fm; |
45 | d->fm = 0; | 38 | d->fm = 0; |
46 | #ifndef QT_NO_TOOLTIP | 39 | #ifndef QT_NO_TOOLTIP |
47 | @@ -2877,6 +2881,48 @@ | 40 | @@ -2877,6 +2881,48 @@ |
48 | } | 41 | } |
49 | 42 | ||
50 | /*! | 43 | /*! |
51 | + This function grabs all paintevents that otherwise would have been | 44 | + This function grabs all paintevents that otherwise would have been |
52 | + processed by the QScrollView::viewportPaintEvent(). Here we use a | 45 | + processed by the QScrollView::viewportPaintEvent(). Here we use a |
53 | + doublebuffer to reduce 'on-paint' flickering on QIconView | 46 | + doublebuffer to reduce 'on-paint' flickering on QIconView |
54 | + (and of course its childs). | 47 | + (and of course its childs). |
55 | + | 48 | + |
56 | + \sa QScrollView::viewportPaintEvent(), QIconView::drawContents() | 49 | + \sa QScrollView::viewportPaintEvent(), QIconView::drawContents() |
57 | +*/ | 50 | +*/ |
58 | + | 51 | + |
59 | +void QIconView::bufferedPaintEvent( QPaintEvent* pe ) | 52 | +void QIconView::bufferedPaintEvent( QPaintEvent* pe ) |
60 | +{ | 53 | +{ |
61 | + QWidget* vp = viewport(); | 54 | + QWidget* vp = viewport(); |
62 | + QRect r = pe->rect() & vp->rect(); | 55 | + QRect r = pe->rect() & vp->rect(); |
63 | + int ex = r.x() + contentsX(); | 56 | + int ex = r.x() + contentsX(); |
64 | + int ey = r.y() + contentsY(); | 57 | + int ey = r.y() + contentsY(); |
65 | + int ew = r.width(); | 58 | + int ew = r.width(); |
66 | + int eh = r.height(); | 59 | + int eh = r.height(); |
67 | + | 60 | + |
68 | + if ( !d->backBuffer ) | 61 | + if ( !d->backBuffer ) |
69 | +d->backBuffer = new QPixmap(vp->size()); | 62 | +d->backBuffer = new QPixmap(vp->size()); |
70 | + if ( d->backBuffer->size() != vp->size() ) { | 63 | + if ( d->backBuffer->size() != vp->size() ) { |
71 | +//Resize function (with hysteesis). Uses a good compromise between memory | 64 | +//Resize function (with hysteesis). Uses a good compromise between memory |
72 | +//consumption and speed (number) of resizes. | 65 | +//consumption and speed (number) of resizes. |
73 | + float newWidth = (float)vp->width(); | 66 | + float newWidth = (float)vp->width(); |
74 | +float newHeight = (float)vp->height(); | 67 | +float newHeight = (float)vp->height(); |
75 | +if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() ) | 68 | +if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() ) |
76 | +{ | 69 | +{ |
77 | + newWidth *= 1.1892; | 70 | + newWidth *= 1.1892; |
78 | + newHeight *= 1.1892; | 71 | + newHeight *= 1.1892; |
79 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); | 72 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); |
80 | +} else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() ) | 73 | +} else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() ) |
81 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); | 74 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); |
82 | + } | 75 | + } |
83 | + | 76 | + |
84 | + QPainter p; | 77 | + QPainter p; |
85 | + p.begin(d->backBuffer, vp); | 78 | + p.begin(d->backBuffer, vp); |
86 | + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); | 79 | + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); |
87 | + p.end(); | 80 | + p.end(); |
88 | + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh); | 81 | + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh); |
89 | +} | 82 | +} |
90 | + | 83 | + |
91 | +/*! | 84 | +/*! |
92 | + | 85 | + |
93 | \reimp | 86 | \reimp |
94 | */ | 87 | */ |
95 | 88 | ||
96 | @@ -4855,7 +4901,7 @@ | 89 | @@ -4855,7 +4901,7 @@ |
97 | if ( !d->rubber ) | 90 | if ( !d->rubber ) |
98 | drawDragShapes( d->oldDragPos ); | 91 | drawDragShapes( d->oldDragPos ); |
99 | } | 92 | } |
100 | - viewportPaintEvent( (QPaintEvent*)e ); | 93 | - viewportPaintEvent( (QPaintEvent*)e ); |
101 | + bufferedPaintEvent ((QPaintEvent*)e ); | 94 | + bufferedPaintEvent ((QPaintEvent*)e ); |
102 | if ( d->dragging ) { | 95 | if ( d->dragging ) { |
103 | if ( !d->rubber ) | 96 | if ( !d->rubber ) |
104 | drawDragShapes( d->oldDragPos ); | 97 | drawDragShapes( d->oldDragPos ); |
105 | @@ -5286,11 +5332,19 @@ | 98 | @@ -5286,11 +5332,19 @@ |
106 | return; | 99 | return; |
107 | 100 | ||
108 | if ( item->d->container1 && d->firstContainer ) { | 101 | if ( item->d->container1 && d->firstContainer ) { |
109 | -item->d->container1->items.removeRef( item ); | 102 | -item->d->container1->items.removeRef( item ); |
110 | + //Special-case checking of the last item, since this may be | 103 | + //Special-case checking of the last item, since this may be |
111 | + //called a few times for the same item. | 104 | + //called a few times for the same item. |
112 | + if (item->d->container1->items.last() == item) | 105 | + if (item->d->container1->items.last() == item) |
113 | + item->d->container1->items.removeLast(); | 106 | + item->d->container1->items.removeLast(); |
114 | + else | 107 | + else |
115 | + item->d->container1->items.removeRef( item ); | 108 | + item->d->container1->items.removeRef( item ); |
116 | } | 109 | } |
117 | item->d->container1 = 0; | 110 | item->d->container1 = 0; |