Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
apply #4819: use QPainterPath instead of QPolygonF for highlighting
  • Loading branch information
thomas authored and jef-n committed Jul 20, 2012
1 parent 8d5d60b commit 3af8320
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/app/qgshighlight.cpp
Expand Up @@ -19,7 +19,6 @@
#include "qgsmaprenderer.h"
#include "qgscoordinatetransform.h"
#include "qgsvectorlayer.h"
#include <QPainter>

/*!
\class QgsHighlight
Expand Down Expand Up @@ -93,11 +92,11 @@ void QgsHighlight::paintLine( QPainter *p, QgsPolyline line )

void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
{
QPolygonF poly;
// OddEven fill rule by default
QPainterPath path;

// just ring outlines, no fill
p->setPen( mPen );
p->setBrush( Qt::NoBrush );
p->setBrush( mBrush );

for ( int i = 0; i < polygon.size(); i++ )
{
Expand All @@ -110,18 +109,10 @@ void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )

ring[ polygon[i].size()] = ring[ 0 ];

p->drawPolygon( ring );

if ( i == 0 )
poly = ring;
else
poly = poly.subtracted( ring );
path.addPolygon( ring );
}

// just fill, no outline
p->setPen( Qt::NoPen );
p->setBrush( mBrush );
p->drawPolygon( poly );
p->drawPath( path );
}

/*!
Expand Down
1 change: 1 addition & 0 deletions src/app/qgshighlight.h
Expand Up @@ -21,6 +21,7 @@
#include <QList>
#include <QPen>
#include <QPainter>
#include <QPainterPath>

class QgsVectorLayer;

Expand Down

0 comments on commit 3af8320

Please sign in to comment.