CWS-TOOLING: integrate CWS aw070_DEV300

2009-04-14 15:12:41 +0200 hdu  r270783 : #i100951# avoid expensive calls to basegfx::tools::clipPolygonOnRange() if possible
2009-04-14 15:04:05 +0200 hdu  r270780 : #i100922# prevent needless stl::priority_queue reallacations by reserving
2009-04-14 14:44:18 +0200 aw  r270776 : #i100851# corrected unxlngi4 warning
2009-04-14 14:41:44 +0200 aw  r270774 : #i100851# applied suggested patch from task
2009-04-14 14:32:30 +0200 aw  r270769 : #i101075# corrected offset usage for wrong spell and transformation mapping for page preview primitives with aspect ratio
2009-04-14 13:56:13 +0200 aw  r270763 : #i101075# changed to empty range usage when collecting page conent for page preview object
This commit is contained in:
Ivo Hinkelmann 2009-04-23 14:51:28 +00:00
parent 176ecc0e36
commit ab9aa0da07

View file

@ -1072,7 +1072,15 @@ struct HalfTrapCompare
}
};
typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueue;
typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueueBase;
// we need a priority queue with a reserve() to prevent countless reallocations
class HTQueue
: public HTQueueBase
{
public:
void reserve( size_t n ) { c.reserve( n ); }
int capacity() { return c.capacity(); }
};
typedef std::vector<XTrapezoid> TrapezoidVector;
@ -1137,15 +1145,16 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
// don't bother with polygons outside of visible area
const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() );
basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly );
aPolyRange.intersect( aViewRange );
if( aPolyRange.isEmpty() )
return true;
const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly );
const bool bNeedViewClip = !aPolyRange.isInside( aViewRange );
if( !aPolyRange.overlaps( aViewRange ) )
return TRUE;
// convert the polypolygon to trapezoids
// first convert the B2DPolyPolygon to HalfTrapezoids
HTQueue aHTQueue;
aHTQueue.reserve( 16384 ); // TODO: use decomposed number of points
for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx )
{
::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx );
@ -1156,10 +1165,15 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
// clip polygon against view
// (the call below for removing self intersections can be made much cheaper by this)
// TODO: move clipping before subdivision when clipPolyonRange learns to handle curves
const basegfx::B2DPolyPolygon aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
if( !aClippedPolygon.count() )
return true;
basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon );
if( bNeedViewClip )
{
// TODO: move clipping before subdivision when clipPolyonRange learns to handle curves
aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" );
if( !aClippedPolygon.count() )
continue;
}
// test and remove self intersections
// TODO: make code intersection save, then remove this test
@ -1172,6 +1186,8 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
if( !nPointCount )
continue;
aHTQueue.reserve( aHTQueue.size() + 8 * nPointCount );
// convert polygon point pairs to HalfTrapezoids
// connect the polygon point with the first one if needed
XPointFixed aOldXPF = { 0, 0 };