diff options
Diffstat (limited to 'vcl/source/gdi/bmpacc3.cxx')
-rw-r--r-- | vcl/source/gdi/bmpacc3.cxx | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index 55f4a8b412a6..50fdcfac9ece 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ void BitmapWriteAccess::SetLineColor() void BitmapWriteAccess::SetLineColor( const Color& rColor ) { delete mpLineColor; - + if( rColor.GetTransparency() == 255 ) mpLineColor = NULL; else @@ -62,12 +62,12 @@ void BitmapWriteAccess::SetLineColor( const Color& rColor ) Color BitmapWriteAccess::GetLineColor() const { Color aRet; - + if( mpLineColor ) aRet = (const Color&) *mpLineColor; else aRet.SetTransparency( 255 ); - + return aRet; } @@ -84,7 +84,7 @@ void BitmapWriteAccess::SetFillColor() void BitmapWriteAccess::SetFillColor( const Color& rColor ) { delete mpFillColor; - + if( rColor.GetTransparency() == 255 ) mpFillColor = NULL; else @@ -96,7 +96,7 @@ void BitmapWriteAccess::SetFillColor( const Color& rColor ) Color BitmapWriteAccess::GetFillColor() const { Color aRet; - + if( mpFillColor ) aRet = (const Color&) *mpFillColor; else @@ -119,9 +119,9 @@ void BitmapWriteAccess::Erase( const Color& rColor ) return; // use the canonical method to clear the bitmap - BitmapColor* pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL; - const Point aPoint; - const Rectangle aRect( aPoint, maBitmap.GetSizePixel() ); + BitmapColor* pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL; + const Point aPoint; + const Rectangle aRect( aPoint, maBitmap.GetSizePixel() ); SetFillColor( rColor ); FillRect( aRect ); @@ -135,17 +135,17 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) { if( mpLineColor ) { - const BitmapColor& rLineColor = *mpLineColor; - long nX, nY; - + const BitmapColor& rLineColor = *mpLineColor; + long nX, nY; + if ( rStart.X() == rEnd.X() ) { // vertikale Line const long nEndY = rEnd.Y(); - + nX = rStart.X(); nY = rStart.Y(); - + if ( nEndY > nY ) { for (; nY <= nEndY; nY++ ) @@ -161,10 +161,10 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) { // horizontale Line const long nEndX = rEnd.X(); - + nX = rStart.X(); nY = rStart.Y(); - + if ( nEndX > nX ) { for (; nX <= nEndX; nX++ ) @@ -178,13 +178,13 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) } else { - const long nDX = labs( rEnd.X() - rStart.X() ); - const long nDY = labs( rEnd.Y() - rStart.Y() ); - long nX1; - long nY1; - long nX2; - long nY2; - + const long nDX = labs( rEnd.X() - rStart.X() ); + const long nDY = labs( rEnd.Y() - rStart.Y() ); + long nX1; + long nY1; + long nX2; + long nY2; + if ( nDX >= nDY ) { if ( rStart.X() < rEnd.X() ) @@ -201,22 +201,22 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) nX2 = rStart.X(); nY2 = rStart.Y(); } - - const long nDYX = ( nDY - nDX ) << 1; - const long nDY2 = nDY << 1; - long nD = nDY2 - nDX; - BOOL bPos = nY1 < nY2; - + + const long nDYX = ( nDY - nDX ) << 1; + const long nDY2 = nDY << 1; + long nD = nDY2 - nDX; + BOOL bPos = nY1 < nY2; + for ( nX = nX1, nY = nY1; nX <= nX2; nX++ ) { SetPixel( nY, nX, rLineColor ); - + if ( nD < 0 ) nD += nDY2; else { nD += nDYX; - + if ( bPos ) nY++; else @@ -240,22 +240,22 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) nX2 = rStart.X(); nY2 = rStart.Y(); } - - const long nDYX = ( nDX - nDY ) << 1; - const long nDY2 = nDX << 1; - long nD = nDY2 - nDY; - BOOL bPos = nX1 < nX2; - + + const long nDYX = ( nDX - nDY ) << 1; + const long nDY2 = nDX << 1; + long nD = nDY2 - nDY; + BOOL bPos = nX1 < nX2; + for ( nX = nX1, nY = nY1; nY <= nY2; nY++ ) { SetPixel( nY, nX, rLineColor ); - + if ( nD < 0 ) nD += nDY2; else { nD += nDYX; - + if ( bPos ) nX++; else @@ -273,19 +273,19 @@ void BitmapWriteAccess::FillRect( const Rectangle& rRect ) { if( mpFillColor ) { - const BitmapColor& rFillColor = *mpFillColor; - Point aPoint; - Rectangle aRect( aPoint, maBitmap.GetSizePixel() ); + const BitmapColor& rFillColor = *mpFillColor; + Point aPoint; + Rectangle aRect( aPoint, maBitmap.GetSizePixel() ); aRect.Intersection( rRect ); if( !aRect.IsEmpty() ) { - const long nStartX = rRect.Left(); - const long nStartY = rRect.Top(); - const long nEndX = rRect.Right(); - const long nEndY = rRect.Bottom(); - + const long nStartX = rRect.Left(); + const long nStartY = rRect.Top(); + const long nEndX = rRect.Right(); + const long nEndY = rRect.Bottom(); + for( long nY = nStartY; nY <= nEndY; nY++ ) for( long nX = nStartX; nX <= nEndX; nX++ ) SetPixel( nY, nX, rFillColor ); @@ -299,7 +299,7 @@ void BitmapWriteAccess::DrawRect( const Rectangle& rRect ) { if( mpFillColor ) FillRect( rRect ); - + if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) ) { DrawLine( rRect.TopLeft(), rRect.TopRight() ); @@ -317,9 +317,9 @@ void BitmapWriteAccess::FillPolygon( const Polygon& rPoly ) if( nSize && mpFillColor ) { - const BitmapColor& rFillColor = *mpFillColor; - Region aRegion( rPoly ); - Rectangle aRect; + const BitmapColor& rFillColor = *mpFillColor; + Region aRegion( rPoly ); + Rectangle aRect; aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) ); @@ -364,16 +364,16 @@ void BitmapWriteAccess::FillPolyPolygon( const PolyPolygon& rPolyPoly ) if( nCount && mpFillColor ) { - const BitmapColor& rFillColor = *mpFillColor; - Region aRegion( rPolyPoly ); - Rectangle aRect; + const BitmapColor& rFillColor = *mpFillColor; + Region aRegion( rPolyPoly ); + Rectangle aRect; aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) ); if( !aRegion.IsEmpty() ) { RegionHandle aRegHandle( aRegion.BeginEnumRects() ); - + while( aRegion.GetNextEnumRect( aRegHandle, aRect ) ) for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ ) for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ ) @@ -390,13 +390,13 @@ void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) { if( mpFillColor ) FillPolyPolygon( rPolyPoly ); - + if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) ) { for( USHORT n = 0, nCount = rPolyPoly.Count(); n < nCount; ) { - const Polygon& rPoly = rPolyPoly[ n++ ]; - const USHORT nSize = rPoly.GetSize(); + const Polygon& rPoly = rPolyPoly[ n++ ]; + const USHORT nSize = rPoly.GetSize(); if( nSize ) { |