diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-28 20:47:12 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-28 20:47:12 +1000 |
commit | db45e761df999c5435bf24fb69f3b0ec7bca16cf (patch) | |
tree | 5db922e145f7e127a08bd5bea0998a6589394b3a /vcl/source/outdev | |
parent | 5416bef7901adcbfc94004e9cd24bdd3d4fc47e2 (diff) |
VCL move DrawGrid from polygon.cxx to rect.cxx
Change-Id: I551901111ee8eee2a9c1cf75890b89f7100d925d
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/polygon.cxx | 99 | ||||
-rw-r--r-- | vcl/source/outdev/rect.cxx | 99 |
2 files changed, 99 insertions, 99 deletions
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index cf3a07393122..632db7d7164e 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -479,103 +479,4 @@ void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const Poly delete pPolyPoly; } -void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) -{ - Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); - aDstRect.Intersection( rRect ); - - if( aDstRect.IsEmpty() || ImplIsRecordLayout() ) - return; - - if( !mpGraphics && !AcquireGraphics() ) - return; - - if( mbInitClipRegion ) - InitClipRegion(); - - if( mbOutputClipped ) - return; - - const long nDistX = std::max( rDist.Width(), 1L ); - const long nDistY = std::max( rDist.Height(), 1L ); - long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX ); - long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY ); - const long nRight = aDstRect.Right(); - const long nBottom = aDstRect.Bottom(); - const long nStartX = ImplLogicXToDevicePixel( nX ); - const long nEndX = ImplLogicXToDevicePixel( nRight ); - const long nStartY = ImplLogicYToDevicePixel( nY ); - const long nEndY = ImplLogicYToDevicePixel( nBottom ); - long nHorzCount = 0L; - long nVertCount = 0L; - - css::uno::Sequence< sal_Int32 > aVertBuf; - css::uno::Sequence< sal_Int32 > aHorzBuf; - - if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_HORZLINES ) ) - { - aVertBuf.realloc( aDstRect.GetHeight() / nDistY + 2L ); - aVertBuf[ nVertCount++ ] = nStartY; - while( ( nY += nDistY ) <= nBottom ) - { - aVertBuf[ nVertCount++ ] = ImplLogicYToDevicePixel( nY ); - } - } - - if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_VERTLINES ) ) - { - aHorzBuf.realloc( aDstRect.GetWidth() / nDistX + 2L ); - aHorzBuf[ nHorzCount++ ] = nStartX; - while( ( nX += nDistX ) <= nRight ) - { - aHorzBuf[ nHorzCount++ ] = ImplLogicXToDevicePixel( nX ); - } - } - - if( mbInitLineColor ) - InitLineColor(); - - if( mbInitFillColor ) - InitFillColor(); - - const bool bOldMap = mbMap; - EnableMapMode( false ); - - if( nFlags & GRID_DOTS ) - { - for( long i = 0L; i < nVertCount; i++ ) - { - for( long j = 0L, Y = aVertBuf[ i ]; j < nHorzCount; j++ ) - { - mpGraphics->DrawPixel( aHorzBuf[ j ], Y, this ); - } - } - } - else - { - if( nFlags & GRID_HORZLINES ) - { - for( long i = 0L; i < nVertCount; i++ ) - { - nY = aVertBuf[ i ]; - mpGraphics->DrawLine( nStartX, nY, nEndX, nY, this ); - } - } - - if( nFlags & GRID_VERTLINES ) - { - for( long i = 0L; i < nHorzCount; i++ ) - { - nX = aHorzBuf[ i ]; - mpGraphics->DrawLine( nX, nStartY, nX, nEndY, this ); - } - } - } - - EnableMapMode( bOldMap ); - - if( mpAlphaVDev ) - mpAlphaVDev->DrawGrid( rRect, rDist, nFlags ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 995b8c240c43..3701354fc4df 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -121,6 +121,105 @@ void OutputDevice::DrawRect( const Rectangle& rRect, mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound ); } +void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) +{ + Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); + aDstRect.Intersection( rRect ); + + if( aDstRect.IsEmpty() || ImplIsRecordLayout() ) + return; + + if( !mpGraphics && !AcquireGraphics() ) + return; + + if( mbInitClipRegion ) + InitClipRegion(); + + if( mbOutputClipped ) + return; + + const long nDistX = std::max( rDist.Width(), 1L ); + const long nDistY = std::max( rDist.Height(), 1L ); + long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX ); + long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY ); + const long nRight = aDstRect.Right(); + const long nBottom = aDstRect.Bottom(); + const long nStartX = ImplLogicXToDevicePixel( nX ); + const long nEndX = ImplLogicXToDevicePixel( nRight ); + const long nStartY = ImplLogicYToDevicePixel( nY ); + const long nEndY = ImplLogicYToDevicePixel( nBottom ); + long nHorzCount = 0L; + long nVertCount = 0L; + + css::uno::Sequence< sal_Int32 > aVertBuf; + css::uno::Sequence< sal_Int32 > aHorzBuf; + + if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_HORZLINES ) ) + { + aVertBuf.realloc( aDstRect.GetHeight() / nDistY + 2L ); + aVertBuf[ nVertCount++ ] = nStartY; + while( ( nY += nDistY ) <= nBottom ) + { + aVertBuf[ nVertCount++ ] = ImplLogicYToDevicePixel( nY ); + } + } + + if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_VERTLINES ) ) + { + aHorzBuf.realloc( aDstRect.GetWidth() / nDistX + 2L ); + aHorzBuf[ nHorzCount++ ] = nStartX; + while( ( nX += nDistX ) <= nRight ) + { + aHorzBuf[ nHorzCount++ ] = ImplLogicXToDevicePixel( nX ); + } + } + + if( mbInitLineColor ) + InitLineColor(); + + if( mbInitFillColor ) + InitFillColor(); + + const bool bOldMap = mbMap; + EnableMapMode( false ); + + if( nFlags & GRID_DOTS ) + { + for( long i = 0L; i < nVertCount; i++ ) + { + for( long j = 0L, Y = aVertBuf[ i ]; j < nHorzCount; j++ ) + { + mpGraphics->DrawPixel( aHorzBuf[ j ], Y, this ); + } + } + } + else + { + if( nFlags & GRID_HORZLINES ) + { + for( long i = 0L; i < nVertCount; i++ ) + { + nY = aVertBuf[ i ]; + mpGraphics->DrawLine( nStartX, nY, nEndX, nY, this ); + } + } + + if( nFlags & GRID_VERTLINES ) + { + for( long i = 0L; i < nHorzCount; i++ ) + { + nX = aHorzBuf[ i ]; + mpGraphics->DrawLine( nX, nStartY, nX, nEndY, this ); + } + } + } + + EnableMapMode( bOldMap ); + + if( mpAlphaVDev ) + mpAlphaVDev->DrawGrid( rRect, rDist, nFlags ); +} + sal_uLong AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix ) { sal_uLong nMirrFlags = 0; |