[QGIS Commit] r13964 -
branches/threading-branch/src/core/symbology-ng
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jul 26 09:26:36 EDT 2010
Author: wonder
Date: 2010-07-26 13:26:36 +0000 (Mon, 26 Jul 2010)
New Revision: 13964
Modified:
branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp
branches/threading-branch/src/core/symbology-ng/qgsrendererv2.h
branches/threading-branch/src/core/symbology-ng/qgssymbolv2.cpp
Log:
Reuse temporary arrays for coordinates
Modified: branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp
===================================================================
--- branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp 2010-07-25 16:14:36 UTC (rev 13963)
+++ branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp 2010-07-26 13:26:36 UTC (rev 13964)
@@ -60,6 +60,7 @@
const QgsMapToPixel& mtp = context.mapToPixel();
double z = 0; // dummy variable for coordiante transform
+ QPointF* data = pts.data();
for ( unsigned int i = 0; i < nPoints; ++i )
{
x = *(( double * ) wkb );
@@ -75,7 +76,7 @@
ct->transformInPlace( x, y, z );
mtp.transformInPlace( x, y );
- pts[i] = QPointF( x, y );
+ data[i] = QPointF( x, y );
}
@@ -187,12 +188,11 @@
QgsDebugMsg( "linestring can be drawn only with line symbol!" );
break;
}
- QPolygonF pts;
- _getLineString( pts, context, geom->asWkb() );
- (( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer, selected );
+ _getLineString( mTmpPoints, context, geom->asWkb() );
+ (( QgsLineSymbolV2* )symbol )->renderPolyline( mTmpPoints, context, layer, selected );
if ( drawVertexMarker )
- renderVertexMarkerPolyline( pts, context );
+ renderVertexMarkerPolyline( mTmpPoints, context );
}
break;
@@ -204,13 +204,12 @@
QgsDebugMsg( "polygon can be drawn only with fill symbol!" );
break;
}
- QPolygonF pts;
- QList<QPolygonF> holes;
- _getPolygon( pts, holes, context, geom->asWkb() );
- (( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context, layer, selected );
+ _getPolygon( mTmpPoints, mTmpHoles, context, geom->asWkb() );
+ (( QgsFillSymbolV2* )symbol )->renderPolygon( mTmpPoints, ( mTmpHoles.count() ? &mTmpHoles : NULL ), context, layer, selected );
+
if ( drawVertexMarker )
- renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context );
+ renderVertexMarkerPolygon( mTmpPoints, ( mTmpHoles.count() ? &mTmpHoles : NULL ), context );
}
break;
@@ -251,15 +250,14 @@
unsigned char* wkb = geom->asWkb();
unsigned int num = *(( int* )( wkb + 5 ) );
unsigned char* ptr = wkb + 9;
- QPolygonF pts;
for ( unsigned int i = 0; i < num; ++i )
{
- ptr = _getLineString( pts, context, ptr );
- (( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer, selected );
+ ptr = _getLineString( mTmpPoints, context, ptr );
+ (( QgsLineSymbolV2* )symbol )->renderPolyline( mTmpPoints, context, layer, selected );
if ( drawVertexMarker )
- renderVertexMarkerPolyline( pts, context );
+ renderVertexMarkerPolyline( mTmpPoints, context );
}
}
break;
@@ -276,16 +274,14 @@
unsigned char* wkb = geom->asWkb();
unsigned int num = *(( int* )( wkb + 5 ) );
unsigned char* ptr = wkb + 9;
- QPolygonF pts;
- QList<QPolygonF> holes;
for ( unsigned int i = 0; i < num; ++i )
{
- ptr = _getPolygon( pts, holes, context, ptr );
- (( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context, layer, selected );
+ ptr = _getPolygon( mTmpPoints, mTmpHoles, context, ptr );
+ (( QgsFillSymbolV2* )symbol )->renderPolygon( mTmpPoints, ( mTmpHoles.count() ? &mTmpHoles : NULL ), context, layer, selected );
if ( drawVertexMarker )
- renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context );
+ renderVertexMarkerPolygon( mTmpPoints, ( mTmpHoles.count() ? &mTmpHoles : NULL ), context );
}
}
break;
Modified: branches/threading-branch/src/core/symbology-ng/qgsrendererv2.h
===================================================================
--- branches/threading-branch/src/core/symbology-ng/qgsrendererv2.h 2010-07-25 16:14:36 UTC (rev 13963)
+++ branches/threading-branch/src/core/symbology-ng/qgsrendererv2.h 2010-07-26 13:26:36 UTC (rev 13964)
@@ -122,6 +122,9 @@
int mCurrentVertexMarkerType;
/** The current size of editing marker */
int mCurrentVertexMarkerSize;
+
+ QPolygonF mTmpPoints;
+ QList<QPolygonF> mTmpHoles;
};
Modified: branches/threading-branch/src/core/symbology-ng/qgssymbolv2.cpp
===================================================================
--- branches/threading-branch/src/core/symbology-ng/qgssymbolv2.cpp 2010-07-25 16:14:36 UTC (rev 13963)
+++ branches/threading-branch/src/core/symbology-ng/qgssymbolv2.cpp 2010-07-26 13:26:36 UTC (rev 13964)
@@ -424,7 +424,7 @@
return;
}
- for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
+ for ( QgsSymbolLayerV2List::ConstIterator it = mLayers.constBegin(); it != mLayers.constEnd(); ++it )
{
QgsLineSymbolLayerV2* layer = ( QgsLineSymbolLayerV2* ) * it;
layer->renderPolyline( points, symbolContext );
More information about the QGIS-commit
mailing list