1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
qt-bugs@ issue : None
Trolltech task ID : None
bugs.kde.org number : None
applied: no
author: Fredrik Höglund <fredrik@kde.org>
Since there's no way to specify that a QPixmap should have an alpha channel
when it's created, it's quite common to call pixmap.fill(Qt::transparent)
immediately after creating it, to force Qt to recreate it with an alpha
channel. Unfortunately QPixmap::fill() does this by creating a QImage,
filling it with the specified color, and then converting it to a QPixmap.
This patch avoids the expensive image->pixmap conversion by simply discarding
the old pixmap, creating a new one with the correct format, and doing the
fill server side.
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1107,7 +1107,26 @@
{
if (fillColor.alpha() != 255) {
#ifndef QT_NO_XRENDER
- if (picture && d == 32) {
+ if (X11->use_xrender) {
+ if (!picture || d != 32) {
+ if (picture)
+ XRenderFreePicture(X11->display, picture);
+ if (mask_picture)
+ XRenderFreePicture(X11->display, mask_picture);
+ if (x11_mask)
+ XFreePixmap(X11->display, x11_mask);
+ if (hd)
+ XFreePixmap(X11->display, hd);
+ if (hd2)
+ XFreePixmap(X11->display, hd2);
+ XRenderPictFormat *format = XRenderFindStandardFormat(X11->display, PictStandardARGB32);
+ hd = XCreatePixmap(X11->display, RootWindow(X11->display, xinfo.screen()), width(), height(), 32);
+ picture = XRenderCreatePicture(X11->display, hd, format, 0, 0);
+ mask_picture = 0;
+ x11_mask = 0;
+ hd2 = 0;
+ d = 32;
+ }
::Picture src = X11->getSolidFill(xinfo.screen(), fillColor);
XRenderComposite(X11->display, PictOpSrc, src, 0, picture,
0, 0, width(), height(),
|