Git commit c3c21ad6b88176b7f4b0f0720ba26d8baacd120b by Torsten Rahn. Committed on 31/10/2015 at 20:15. Pushed by rahn into branch 'master'. Somewhat nicer code for the polygon texture brush. M +13 -9 src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.c= pp http://commits.kde.org/marble/c3c21ad6b88176b7f4b0f0720ba26d8baacd120b diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp= b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp index ad1f9c0..149e77a 100644 --- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp +++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp @@ -182,6 +182,8 @@ void GeoPolygonGraphicsItem::paint( GeoPainter* painter= , const ViewportParams* v { painter->save(); = + + bool const isBuildingFrame =3D isDecoration(); bool const isBuildingRoof =3D !isDecoration() && !decorations().isEmpt= y(); = @@ -225,19 +227,21 @@ void GeoPolygonGraphicsItem::paint( GeoPainter* paint= er, const ViewportParams* v qreal x, y; viewport->screenCoordinates(coords, x, y); if (m_cachedTexturePath !=3D style()->polyStyle().text= urePath() || m_cachedTextureColor !=3D style()->polyStyle().paintedColor() = ) { - m_cachedTexture =3D QImage ( textureImage.size(), = QImage::Format_ARGB32_Premultiplied ); - m_cachedTexture.fill(style()->polyStyle().paintedC= olor()); - QPainter imagePainter(&m_cachedTexture ); - imagePainter.drawImage(0, 0, textureImage); - imagePainter.end(); + if (textureImage.hasAlphaChannel()) { + m_cachedTexture =3D QImage ( textureImage.size= (), QImage::Format_ARGB32_Premultiplied ); + m_cachedTexture.fill(style()->polyStyle().pain= tedColor()); + QPainter imagePainter(&m_cachedTexture ); + imagePainter.drawImage(0, 0, textureImage); + } + else { + m_cachedTexture =3D textureImage; + } m_cachedTexturePath =3D style()->polyStyle().textu= rePath(); m_cachedTextureColor =3D style()->polyStyle().pain= tedColor(); } - QBrush brush; - brush.setTextureImage(m_cachedTexture); - QTransform transform; - brush.setTransform(transform.translate(x,y)); + QBrush brush(m_cachedTexture); painter->setBrush(brush); + painter->setBrushOrigin(QPoint(x,y)); } else { painter->setBrush( style()->polyStyle().paintedColor()= ); }