diff options
Diffstat (limited to 'vcl/unx/source/gdi/pspgraphics.cxx')
-rw-r--r-- | vcl/unx/source/gdi/pspgraphics.cxx | 97 |
1 files changed, 47 insertions, 50 deletions
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index bdccf4a82e01..7308827bdeb7 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -42,6 +42,7 @@ #include "vcl/svapp.hxx" #include "vcl/salprn.hxx" #include "vcl/sysdata.hxx" +#include "vcl/region.h" #include <stdlib.h> #include <unistd.h> @@ -281,7 +282,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -USHORT PspGraphics::GetBitCount() const +sal_uInt16 PspGraphics::GetBitCount() const { return m_pPrinterGfx->GetBitCount(); } @@ -293,28 +294,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( ULONG n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -BOOL PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (BOOL)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY); -} - -bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + // TODO: support polygonal clipregions here + m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() ); -void PspGraphics::EndSetClipRegion() -{ - m_pPrinterGfx->EndSetClipRegion (); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + m_pPrinterGfx->EndSetClipRegion(); + return true; } void PspGraphics::SetLineColor() @@ -382,12 +382,12 @@ void PspGraphics::drawRect( long nX, long nY, long nDX, long nDY ) m_pPrinterGfx->DrawRect (Rectangle(Point(nX, nY), Size(nDX, nDY))); } -void PspGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) +void PspGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry ) { m_pPrinterGfx->DrawPolyLine (nPoints, (Point*)pPtAry); } -void PspGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void PspGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx m_pPrinterGfx->DrawPolygon (nPoints, (Point*)pPtAry); @@ -412,13 +412,13 @@ bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTransparen return false; } -sal_Bool PspGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolyLineBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; } -sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolygonBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; @@ -427,20 +427,20 @@ sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, sal_Bool PspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ) + const sal_uInt8* const* pFlgAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx - m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (BYTE**)pFlgAry); + m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (sal_uInt8**)pFlgAry); return sal_True; } -void PspGraphics::invert( ULONG, +void PspGraphics::invert( sal_uLong, const SalPoint*, SalInvert ) { DBG_ASSERT( 0, "Error: PrinterGfx::Invert() not implemented" ); } -BOOL PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) +sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) { return m_pPrinterGfx->DrawEPS( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ), pPtr, nSize ); } @@ -451,7 +451,7 @@ void PspGraphics::copyBits( const SalTwoRect*, OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" ); } -void PspGraphics::copyArea ( long,long,long,long,long,long,USHORT ) +void PspGraphics::copyArea ( long,long,long,long,long,long,sal_uInt16 ) { OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" ); } @@ -770,16 +770,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) DrawPrinterLayout( rLayout, *m_pPrinterGfx, true ); } -ImplFontCharMap* PspGraphics::GetImplFontCharMap() const +const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const @@ -789,7 +786,7 @@ bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabiliti return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); } -USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) +sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { // release all fonts that are to be overridden for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) @@ -920,10 +917,10 @@ void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int ) } } -ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) +sal_uLong PspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs ) { const ::std::list< ::psp::KernPair >& rPairs( m_pPrinterGfx->getKernPairs() ); - ULONG nHavePairs = rPairs.size(); + sal_uLong nHavePairs = rPairs.size(); if( pKernPairs && nPairs ) { ::std::list< ::psp::KernPair >::const_iterator it; @@ -942,38 +939,38 @@ ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) return nHavePairs; } -BOOL PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); - return TRUE; + return sal_True; } -BOOL PspGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rB2DPolyPoly ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) @@ -1012,7 +1009,7 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel //-------------------------------------------------------------------------- -BOOL PspGraphics::CreateFontSubset( +sal_Bool PspGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, sal_Int32* pGlyphIDs, @@ -1407,9 +1404,9 @@ bool PspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrLen bool bRet = false; bool bStarted = false; bool bStopped = false; - USHORT nPos; - USHORT nStart = 0; - USHORT nStop = rLen; + sal_uInt16 nPos; + sal_uInt16 nStart = 0; + sal_uInt16 nStop = rLen; String aPhone = rOrig.Copy( nIndex, rLen ); if( ! m_bPhoneCollectionActive ) |