Skip to content

Commit ec7838e

Browse files
author
morb_au
committedFeb 16, 2006
Modification to make sure that QPixmaps do not get filled with a transparent colour, if the X11 system does not have the RENDER extension at runtime.
git-svn-id: http://svn.osgeo.org/qgis/trunk@4867 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 935e6b5 commit ec7838e

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed
 

‎src/core/qgsmarkercatalogue.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,27 @@ QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrus
9191
{
9292
QPicture myPicture = hardMarker ( fullName.mid(5), size, pen, brush, qtBug );
9393
QPixmap myPixmap = QPixmap (myPicture.width(),myPicture.height());
94-
myPixmap.fill(QColor(255,255,255,0)); //transparent
94+
95+
// The following is window-system-conditional since (at least)
96+
// the combination of Qt 4.1.0 and RealVNC's Xvnc 4.1
97+
// will result in the pixmap becoming invisible if it is filled
98+
// with a non-opaque colour.
99+
// This is probably because Xvnc 4.1 doesn't have the RENDER
100+
// extension compiled into it.
101+
#if defined(Q_WS_X11)
102+
// Do a runtime test to see if the X RENDER extension is available
103+
if ( myPixmap.x11PictureHandle() )
104+
{
105+
#endif
106+
myPixmap.fill(QColor(255,255,255,0)); // transparent
107+
#if defined(Q_WS_X11)
108+
}
109+
else
110+
{
111+
myPixmap.fill(QColor(255,255,255)); // opaque
112+
}
113+
#endif
114+
95115
QPainter myPainter(&myPixmap);
96116
myPainter.drawPicture(0,0,myPicture);
97117
return myPixmap;

‎src/core/qgssvgcache.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,27 @@ QPixmap QgsSVGCache::getPixmap(QString filename, double scaleFactor)
9696

9797
//QPixmap myPixmap = QPixmap(width,height);
9898
QPixmap myPixmap = QPixmap(scaleFactor,scaleFactor);
99-
myPixmap.fill(QColor(255,255,255,0)); //transparent
99+
100+
// The following is window-system-conditional since (at least)
101+
// the combination of Qt 4.1.0 and RealVNC's Xvnc 4.1
102+
// will result in the pixmap becoming invisible if it is filled
103+
// with a non-opaque colour.
104+
// This is probably because Xvnc 4.1 doesn't have the RENDER
105+
// extension compiled into it.
106+
#if defined(Q_WS_X11)
107+
// Do a runtime test to see if the X RENDER extension is available
108+
if ( myPixmap.x11PictureHandle() )
109+
{
110+
#endif
111+
myPixmap.fill(QColor(255,255,255,0)); // transparent
112+
#if defined(Q_WS_X11)
113+
}
114+
else
115+
{
116+
myPixmap.fill(QColor(255,255,255)); // opaque
117+
}
118+
#endif
119+
100120
QPainter myPainter(&myPixmap);
101121
myPainter.setRenderHint(QPainter::Antialiasing);
102122
mySVG.render(&myPainter);

0 commit comments

Comments
 (0)
Please sign in to comment.