diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-04 15:10:20 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-04 15:10:20 +0100 |
commit | 128adf7e5c06fff378c8d72b44ec4be1e462984f (patch) | |
tree | 72d16badd9687180250b63d3db29637aa16a6e66 /sdext | |
parent | db944ee55fc510ca5940728b0d16a852f12842d8 (diff) |
vcl119: #i109708# use fill, then stroke one small polygons (thanks joekidd)
Diffstat (limited to 'sdext')
-rwxr-xr-x | sdext/source/pdfimport/wrapper/wrapper.cxx | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index f9255393ae6e..daa7cd42b61e 100755 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -158,6 +158,8 @@ class Parser sal_Int32 m_nNextToken; sal_Int32 m_nCharIndex; + const double minAreaThreshold; + const double minLineWidth; ::rtl::OString readNextToken(); void readInt32( sal_Int32& o_Value ); @@ -167,7 +169,7 @@ class Parser double readDouble(); void readBinaryData( uno::Sequence<sal_Int8>& rBuf ); - uno::Reference<rendering::XPolyPolygon2D> readPath(); + uno::Reference<rendering::XPolyPolygon2D> readPath( double* ); void readChar(); void readLineCap(); @@ -199,7 +201,9 @@ public: m_aLine(), m_aFontMap(101), m_nNextToken(-1), - m_nCharIndex(-1) + m_nCharIndex(-1), + minAreaThreshold( 300.0 ), + minLineWidth( 12 ) {} void parseLine( const ::rtl::OString& rLine ); @@ -306,7 +310,7 @@ void Parser::readBinaryData( uno::Sequence<sal_Int8>& rBuf ) OSL_PRECOND(nRes==osl_File_E_None, "inconsistent data"); } -uno::Reference<rendering::XPolyPolygon2D> Parser::readPath() +uno::Reference<rendering::XPolyPolygon2D> Parser::readPath( double* pArea = NULL ) { const rtl::OString aSubPathMarker( "subpath" ); @@ -366,6 +370,15 @@ uno::Reference<rendering::XPolyPolygon2D> Parser::readPath() readNextToken(); } + if( pArea ) + { + basegfx::B2DRange aRange( aResult.getB2DRange() ); + if( aRange.getWidth() <= minLineWidth || aRange.getHeight() <= minLineWidth) + *pArea = 0.0; + else + *pArea = aRange.getWidth() * aRange.getHeight(); + } + return static_cast<rendering::XLinePolyPolygon2D*>( new basegfx::unotools::UnoPolyPolygon(aResult)); } @@ -805,9 +818,25 @@ void Parser::parseLine( const ::rtl::OString& rLine ) case EOCLIPPATH: m_pSink->intersectEoClip(readPath()); break; case EOFILLPATH: - m_pSink->eoFillPath(readPath()); break; + { + double area = 0.0; + uno::Reference<rendering::XPolyPolygon2D> path = readPath( &area ); + m_pSink->eoFillPath(path); + // if area is smaller than required, add borders. + if(area < minAreaThreshold) + m_pSink->strokePath(path); + } + break; case FILLPATH: - m_pSink->fillPath(readPath()); break; + { + double area = 0.0; + uno::Reference<rendering::XPolyPolygon2D> path = readPath( &area ); + m_pSink->fillPath(path); + // if area is smaller than required, add borders. + if(area < minAreaThreshold) + m_pSink->strokePath(path); + } + break; case RESTORESTATE: m_pSink->popState(); break; case SAVESTATE: |