vcl/source/outdev/outdev.cxx | 24 -------- vcl/source/outdev/polygon.cxx | 100 --------------------------------- vcl/source/outdev/rect.cxx | 125 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 123 insertions(+), 126 deletions(-)
New commits: commit 3d91d54c49af4dd0832c27ccb9721724fa98b6b5 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Mon Apr 28 20:48:31 2014 +1000 VCL move DrawCheckered from outdev.cxx to rect.cxx Change-Id: I55cbab29e4e0d772e593f39ba48a3a2dffbce382 diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 7eb435e..5af2be3 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -985,28 +985,4 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } -void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd) -{ - const sal_uInt32 nMaxX(rPos.X() + rSize.Width()); - const sal_uInt32 nMaxY(rPos.Y() + rSize.Height()); - - Push(PUSH_LINECOLOR|PUSH_FILLCOLOR); - SetLineColor(); - - for(sal_uInt32 x(0), nX(rPos.X()); nX < nMaxX; x++, nX += nLen) - { - const sal_uInt32 nRight(std::min(nMaxX, nX + nLen)); - - for(sal_uInt32 y(0), nY(rPos.Y()); nY < nMaxY; y++, nY += nLen) - { - const sal_uInt32 nBottom(std::min(nMaxY, nY + nLen)); - - SetFillColor((x & 0x0001) ^ (y & 0x0001) ? aStart : aEnd); - DrawRect(Rectangle(nX, nY, nRight, nBottom)); - } - } - - Pop(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 3701354..285100c 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -121,6 +121,30 @@ void OutputDevice::DrawRect( const Rectangle& rRect, mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound ); } +void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd) +{ + const sal_uInt32 nMaxX(rPos.X() + rSize.Width()); + const sal_uInt32 nMaxY(rPos.Y() + rSize.Height()); + + Push(PUSH_LINECOLOR|PUSH_FILLCOLOR); + SetLineColor(); + + for(sal_uInt32 x(0), nX(rPos.X()); nX < nMaxX; x++, nX += nLen) + { + const sal_uInt32 nRight(std::min(nMaxX, nX + nLen)); + + for(sal_uInt32 y(0), nY(rPos.Y()); nY < nMaxY; y++, nY += nLen) + { + const sal_uInt32 nBottom(std::min(nMaxY, nY + nLen)); + + SetFillColor((x & 0x0001) ^ (y & 0x0001) ? aStart : aEnd); + DrawRect(Rectangle(nX, nY, nRight, nBottom)); + } + } + + Pop(); +} + void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) { Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); commit db45e761df999c5435bf24fb69f3b0ec7bca16cf Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Mon Apr 28 20:47:12 2014 +1000 VCL move DrawGrid from polygon.cxx to rect.cxx Change-Id: I551901111ee8eee2a9c1cf75890b89f7100d925d diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index cf3a073..632db7d 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 995b8c2..3701354 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; commit 5416bef7901adcbfc94004e9cd24bdd3d4fc47e2 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Mon Apr 28 20:45:33 2014 +1000 VCL: remove newline from DrawGrid in outdev/rect.cxx Change-Id: Iff26673bd97827bca20b19937591c1fbc69bdf4f diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index b3c6001..cf3a073 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -481,7 +481,6 @@ void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const Poly void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ) { - Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() ); aDstRect.Intersection( rRect ); commit c028b0059a4ec12590593e56642db5264bdb4835 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Mon Apr 28 20:44:36 2014 +1000 VCL: remove newline from outdev/rect.cxx Change-Id: I90b3c0369a54c22a87bd660801b5ea384e01c19a diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 8a847fc..995b8c2 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -28,7 +28,6 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) { - if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRectAction( rRect ) ); @@ -66,7 +65,6 @@ void OutputDevice::DrawRect( const Rectangle& rRect ) void OutputDevice::DrawRect( const Rectangle& rRect, sal_uLong nHorzRound, sal_uLong nVertRound ) { - if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits