author | zecke <zecke> | 2004-07-23 18:18:15 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-23 18:18:15 (UTC) |
commit | f9499e14b777050f0bdb3821ca8421dd4c7231fd (patch) (unidiff) | |
tree | 7d96a449aa3b211bd7c5bc9f4d5a7908005cd287 /qt/qt-2.3.7.patch/qte237-iconviewspeed.patch | |
parent | 984ab6b8bccf667a89062d959defed4a5d86bfb1 (diff) | |
download | opie-f9499e14b777050f0bdb3821ca8421dd4c7231fd.zip opie-f9499e14b777050f0bdb3821ca8421dd4c7231fd.tar.gz opie-f9499e14b777050f0bdb3821ca8421dd4c7231fd.tar.bz2 |
Split up the patches for Qt2.3.7 and Qt2.3.8 and add comments
on what they do
Diffstat (limited to 'qt/qt-2.3.7.patch/qte237-iconviewspeed.patch') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qt/qt-2.3.7.patch/qte237-iconviewspeed.patch | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch b/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch new file mode 100644 index 0000000..63e45ec --- a/dev/null +++ b/qt/qt-2.3.7.patch/qte237-iconviewspeed.patch | |||
@@ -0,0 +1,149 @@ | |||
1 | Speed up patches backported from | ||
2 | |||
3 | http://robotics.dei.unipd.it/~koral/KDE/kflicker.html | ||
4 | |||
5 | and | ||
6 | |||
7 | http://lists.kde.org/?l=kde-optimize&m=105382164111363&w=2 (complete thread) | ||
8 | |||
9 | |||
10 | |||
11 | |||
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 | ||
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 @@ | ||
23 | QIconView::SelectionMode selectionMode; | ||
24 | QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor; | ||
25 | QRect *rubber; | ||
26 | + QPixmap *backBuffer; | ||
27 | QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer, | ||
28 | *fullRedrawTimer; | ||
29 | int rastX, rastY, spacing; | ||
30 | @@ -2263,6 +2264,7 @@ | ||
31 | d->currentItem = 0; | ||
32 | d->highlightedItem = 0; | ||
33 | d->rubber = 0; | ||
34 | + d->backBuffer = 0; | ||
35 | d->scrollTimer = 0; | ||
36 | d->startDragItem = 0; | ||
37 | d->tmpCurrentItem = 0; | ||
38 | @@ -2411,6 +2413,8 @@ | ||
39 | delete item; | ||
40 | item = tmp; | ||
41 | } | ||
42 | + delete d->backBuffer; | ||
43 | + d->backBuffer = 0; | ||
44 | delete d->fm; | ||
45 | d->fm = 0; | ||
46 | #ifndef QT_NO_TOOLTIP | ||
47 | @@ -2877,6 +2881,48 @@ | ||
48 | } | ||
49 | |||
50 | /*! | ||
51 | + This function grabs all paintevents that otherwise would have been | ||
52 | + processed by the QScrollView::viewportPaintEvent(). Here we use a | ||
53 | + doublebuffer to reduce 'on-paint' flickering on QIconView | ||
54 | + (and of course its childs). | ||
55 | + | ||
56 | + \sa QScrollView::viewportPaintEvent(), QIconView::drawContents() | ||
57 | +*/ | ||
58 | + | ||
59 | +void QIconView::bufferedPaintEvent( QPaintEvent* pe ) | ||
60 | +{ | ||
61 | + QWidget* vp = viewport(); | ||
62 | + QRect r = pe->rect() & vp->rect(); | ||
63 | + int ex = r.x() + contentsX(); | ||
64 | + int ey = r.y() + contentsY(); | ||
65 | + int ew = r.width(); | ||
66 | + int eh = r.height(); | ||
67 | + | ||
68 | + if ( !d->backBuffer ) | ||
69 | +d->backBuffer = new QPixmap(vp->size()); | ||
70 | + if ( d->backBuffer->size() != vp->size() ) { | ||
71 | +//Resize function (with hysteesis). Uses a good compromise between memory | ||
72 | +//consumption and speed (number) of resizes. | ||
73 | + float newWidth = (float)vp->width(); | ||
74 | +float newHeight = (float)vp->height(); | ||
75 | +if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() ) | ||
76 | +{ | ||
77 | + newWidth *= 1.1892; | ||
78 | + newHeight *= 1.1892; | ||
79 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); | ||
80 | +} else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() ) | ||
81 | + d->backBuffer->resize( (int)newWidth, (int)newHeight ); | ||
82 | + } | ||
83 | + | ||
84 | + QPainter p; | ||
85 | + p.begin(d->backBuffer, vp); | ||
86 | + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); | ||
87 | + p.end(); | ||
88 | + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh); | ||
89 | +} | ||
90 | + | ||
91 | +/*! | ||
92 | + | ||
93 | \reimp | ||
94 | */ | ||
95 | |||
96 | @@ -4855,7 +4901,7 @@ | ||
97 | if ( !d->rubber ) | ||
98 | drawDragShapes( d->oldDragPos ); | ||
99 | } | ||
100 | - viewportPaintEvent( (QPaintEvent*)e ); | ||
101 | + bufferedPaintEvent ((QPaintEvent*)e ); | ||
102 | if ( d->dragging ) { | ||
103 | if ( !d->rubber ) | ||
104 | drawDragShapes( d->oldDragPos ); | ||
105 | @@ -5286,11 +5332,19 @@ | ||
106 | return; | ||
107 | |||
108 | if ( item->d->container1 && d->firstContainer ) { | ||
109 | -item->d->container1->items.removeRef( item ); | ||
110 | + //Special-case checking of the last item, since this may be | ||
111 | + //called a few times for the same item. | ||
112 | + if (item->d->container1->items.last() == item) | ||
113 | + item->d->container1->items.removeLast(); | ||
114 | + else | ||
115 | + item->d->container1->items.removeRef( item ); | ||
116 | } | ||
117 | item->d->container1 = 0; | ||
118 | if ( item->d->container2 && d->firstContainer ) { | ||
119 | -item->d->container2->items.removeRef( item ); | ||
120 | + if (item->d->container2->items.last() == item) | ||
121 | + item->d->container2->items.removeLast(); | ||
122 | + else | ||
123 | + item->d->container2->items.removeRef( item ); | ||
124 | } | ||
125 | item->d->container2 = 0; | ||
126 | |||
127 | diff -u qt-2.3.7_old/src/iconview/qiconview.h qt-2.3.7/src/iconview/qiconview.h | ||
128 | --- qt-2.3.7_old/src/iconview/qiconview.h2004-06-13 22:29:56.000000000 +0200 | ||
129 | +++ qt-2.3.7/src/iconview/qiconview.h2004-06-13 22:33:32.000000000 +0200 | ||
130 | @@ -444,6 +444,7 @@ | ||
131 | virtual void contentsDropEvent( QDropEvent *e ); | ||
132 | #endif | ||
133 | |||
134 | + void bufferedPaintEvent( QPaintEvent* ); | ||
135 | virtual void resizeEvent( QResizeEvent* e ); | ||
136 | virtual void keyPressEvent( QKeyEvent *e ); | ||
137 | virtual void focusInEvent( QFocusEvent *e ); | ||
138 | --- qt-2.3.7-old/src/widgets/qscrollview.cpp2004-07-23 15:22:56.000000000 +0200 | ||
139 | +++ qt-2.3.7/src/widgets/qscrollview.cpp2004-07-23 19:23:10.000000000 +0200 | ||
140 | @@ -1266,6 +1277,9 @@ | ||
141 | case QEvent::LayoutHint: | ||
142 | d->autoResizeHint(this); | ||
143 | break; | ||
144 | +case QEvent::WindowActivate: | ||
145 | +case QEvent::WindowDeactivate: | ||
146 | + return TRUE; | ||
147 | default: | ||
148 | break; | ||
149 | } | ||