[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble] src/lib/marble/geodata/graphicsitem: Somewhat nicer code for the polygon texture brush.
From:       Torsten Rahn <torsten.rahn () lge ! com>
Date:       2015-10-31 20:16:20
Message-ID: E1ZscZY-0006yK-Qd () scm ! kde ! org
[Download RAW message or body]

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.cpp

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 = isDecoration();
     bool const isBuildingRoof = !isDecoration() && !decorations().isEmpty();
 
@@ -225,19 +227,21 @@ void GeoPolygonGraphicsItem::paint( GeoPainter* painter, const \
ViewportParams* v  qreal x, y;
                     viewport->screenCoordinates(coords, x, y);
                     if (m_cachedTexturePath != style()->polyStyle().texturePath() || \
                m_cachedTextureColor != style()->polyStyle().paintedColor() ) {
-                        m_cachedTexture = QImage ( textureImage.size(), \
                QImage::Format_ARGB32_Premultiplied );
-                        m_cachedTexture.fill(style()->polyStyle().paintedColor());
-                        QPainter imagePainter(&m_cachedTexture );
-                        imagePainter.drawImage(0, 0, textureImage);
-                        imagePainter.end();
+                        if (textureImage.hasAlphaChannel()) {
+                            m_cachedTexture = QImage ( textureImage.size(), \
QImage::Format_ARGB32_Premultiplied ); +                            \
m_cachedTexture.fill(style()->polyStyle().paintedColor()); +                          \
QPainter imagePainter(&m_cachedTexture ); +                            \
imagePainter.drawImage(0, 0, textureImage); +                        }
+                        else {
+                            m_cachedTexture = textureImage;
+                        }
                         m_cachedTexturePath = style()->polyStyle().texturePath();
                         m_cachedTextureColor = style()->polyStyle().paintedColor();
                     }
-                    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() );
                 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic