@@ -160,17 +160,16 @@ void QgsComposerMap::cache( void )
160
160
h = 5000 ;
161
161
}
162
162
163
- mCachePixmap = QPixmap ( w, h );
163
+ mCacheImage = QImage ( w, h, QImage::Format_ARGB32);
164
+ mCacheImage .fill (brush ().color ().rgb ()); // consider the item background brush
164
165
double mapUnitsPerPixel = mExtent .width () / w;
165
166
166
167
// WARNING: ymax in QgsMapToPixel is device height!!!
167
168
QgsMapToPixel transform ( mapUnitsPerPixel, h, mExtent .yMinimum (), mExtent .xMinimum () );
168
169
169
- mCachePixmap . fill ( QColor ( 255 , 255 , 255 ) );
170
+ QPainter p ( & mCacheImage );
170
171
171
- QPainter p ( &mCachePixmap );
172
-
173
- draw ( &p, mExtent , QSize ( w, h ), mCachePixmap .logicalDpiX () );
172
+ draw ( &p, mExtent , QSize ( w, h ), mCacheImage .logicalDpiX () );
174
173
p.end ();
175
174
mCacheUpdated = true ;
176
175
}
@@ -206,11 +205,11 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i
206
205
// client functions
207
206
208
207
// Scale so that the cache fills the map rectangle
209
- double scale = 1.0 * QGraphicsRectItem::rect ().width () / mCachePixmap .width ();
208
+ double scale = 1.0 * QGraphicsRectItem::rect ().width () / mCacheImage .width ();
210
209
211
210
painter->save ();
212
211
painter->scale ( scale, scale );
213
- painter->drawPixmap ( mXOffset / scale, mYOffset / scale, mCachePixmap );
212
+ painter->drawImage ( mXOffset / scale, mYOffset / scale, mCacheImage );
214
213
painter->restore ();
215
214
}
216
215
else if ( mComposition ->plotStyle () == QgsComposition::Print ||
0 commit comments