diff options
Diffstat (limited to 'canvas/source/vcl/impltools.cxx')
-rw-r--r-- | canvas/source/vcl/impltools.cxx | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 1b6829784ab3..86d82098ef32 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.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 @@ -96,7 +96,7 @@ namespace vclcanvas } // TODO(F2): add support for floating point bitmap formats - uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntBmp( + uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntBmp( xBitmap, uno::UNO_QUERY_THROW ); ::BitmapEx aBmpEx = ::vcl::unotools::bitmapExFromXBitmap( xIntBmp ); @@ -104,21 +104,21 @@ namespace vclcanvas return aBmpEx; // TODO(F1): extract pixel from XBitmap interface - ENSURE_OR_THROW( false, + ENSURE_OR_THROW( false, "bitmapExFromXBitmap(): could not extract bitmap" ); } - + return ::BitmapEx(); } - bool setupFontTransform( ::Point& o_rPoint, - ::Font& io_rVCLFont, - const rendering::ViewState& rViewState, - const rendering::RenderState& rRenderState, - ::OutputDevice& rOutDev ) + bool setupFontTransform( ::Point& o_rPoint, + ::Font& io_rVCLFont, + const rendering::ViewState& rViewState, + const rendering::RenderState& rRenderState, + ::OutputDevice& rOutDev ) { ::basegfx::B2DHomMatrix aMatrix; - + ::canvas::tools::mergeViewAndRenderTransform(aMatrix, rViewState, rRenderState); @@ -126,12 +126,12 @@ namespace vclcanvas ::basegfx::B2DTuple aScale; ::basegfx::B2DTuple aTranslate; double nRotate, nShearX; - + aMatrix.decompose( aScale, aTranslate, nRotate, nShearX ); // #i72417# detecting the 180 degree rotation case manually here. - if( aScale.getX() < 0.0 && - aScale.getY() < 0.0 && + if( aScale.getX() < 0.0 && + aScale.getY() < 0.0 && basegfx::fTools::equalZero(nRotate) ) { aScale *= -1.0; @@ -191,9 +191,9 @@ namespace vclcanvas // VCL-Canvas related //--------------------------------------------------------------------- - ::Point mapRealPoint2D( const geometry::RealPoint2D& rPoint, - const rendering::ViewState& rViewState, - const rendering::RenderState& rRenderState ) + ::Point mapRealPoint2D( const geometry::RealPoint2D& rPoint, + const rendering::ViewState& rViewState, + const rendering::RenderState& rRenderState ) { ::basegfx::B2DPoint aPoint( ::basegfx::unotools::b2DPointFromRealPoint2D(rPoint) ); @@ -205,9 +205,9 @@ namespace vclcanvas return ::vcl::unotools::pointFromB2DPoint( aPoint ); } - ::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, - const rendering::ViewState& rViewState, - const rendering::RenderState& rRenderState ) + ::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, + const rendering::ViewState& rViewState, + const rendering::RenderState& rRenderState ) { ::basegfx::B2DHomMatrix aMatrix; ::canvas::tools::mergeViewAndRenderTransform(aMatrix, @@ -221,28 +221,28 @@ namespace vclcanvas return ::PolyPolygon( aTemp ); } - ::BitmapEx transformBitmap( const BitmapEx& rBitmap, - const ::basegfx::B2DHomMatrix& rTransform, - const uno::Sequence< double >& rDeviceColor, - ModulationMode eModulationMode ) + ::BitmapEx transformBitmap( const BitmapEx& rBitmap, + const ::basegfx::B2DHomMatrix& rTransform, + const uno::Sequence< double >& rDeviceColor, + ModulationMode eModulationMode ) { RTL_LOGFILE_CONTEXT( aLog, "::vclcanvas::tools::transformBitmap()" ); RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::vclcanvas::tools::transformBitmap: 0x%X", &rBitmap ); - + // calc transformation and size of bitmap to be // generated. Note, that the translational components are // deleted from the transformation; this can be handled by // an offset when painting the bitmap - const Size aBmpSize( rBitmap.GetSizePixel() ); - ::basegfx::B2DRectangle aDestRect; - + const Size aBmpSize( rBitmap.GetSizePixel() ); + ::basegfx::B2DRectangle aDestRect; + bool bCopyBack( false ); // calc effective transformation for bitmap const ::basegfx::B2DRectangle aSrcRect( 0, 0, aBmpSize.Width(), aBmpSize.Height() ); - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::canvas::tools::calcTransformedRectBounds( aDestRect, aSrcRect, rTransform ); @@ -260,7 +260,7 @@ namespace vclcanvas const double nRedModulation( bModulateColors ? rDeviceColor[0] : 1.0 ); const double nGreenModulation( bModulateColors ? rDeviceColor[1] : 1.0 ); const double nBlueModulation( bModulateColors ? rDeviceColor[2] : 1.0 ); - const double nAlphaModulation( bModulateColors && rDeviceColor.getLength() > 3 ? + const double nAlphaModulation( bModulateColors && rDeviceColor.getLength() > 3 ? rDeviceColor[3] : 1.0 ); Bitmap aSrcBitmap( rBitmap.GetBitmap() ); @@ -278,8 +278,8 @@ namespace vclcanvas ScopedBitmapReadAccess pReadAccess( aSrcBitmap.AcquireReadAccess(), aSrcBitmap ); - ScopedBitmapReadAccess pAlphaReadAccess( rBitmap.IsTransparent() ? - aSrcAlpha.AcquireReadAccess() : + ScopedBitmapReadAccess pAlphaReadAccess( rBitmap.IsTransparent() ? + aSrcAlpha.AcquireReadAccess() : (BitmapReadAccess*)NULL, aSrcAlpha ); @@ -287,7 +287,7 @@ namespace vclcanvas (pAlphaReadAccess.get() == NULL && rBitmap.IsTransparent()) ) { // TODO(E2): Error handling! - ENSURE_OR_THROW( false, + ENSURE_OR_THROW( false, "transformBitmap(): could not access source bitmap" ); } @@ -318,7 +318,7 @@ namespace vclcanvas } // else: mapping table is not used - const Size aDestBmpSize( ::basegfx::fround( aDestRect.getWidth() ), + const Size aDestBmpSize( ::basegfx::fround( aDestRect.getWidth() ), ::basegfx::fround( aDestRect.getHeight() ) ); if( aDestBmpSize.Width() == 0 || aDestBmpSize.Height() == 0 ) @@ -338,7 +338,7 @@ namespace vclcanvas ScopedBitmapWriteAccess pAlphaWriteAccess( aDstAlpha.AcquireWriteAccess(), aDstAlpha ); - + if( pWriteAccess.get() != NULL && pAlphaWriteAccess.get() != NULL && rTransform.isInvertible() ) @@ -348,8 +348,8 @@ namespace vclcanvas // source ::basegfx::B2DHomMatrix aTransform( aLocalTransform ); aTransform.invert(); - - // for the time being, always read as ARGB + + // for the time being, always read as ARGB for( int y=0; y<aDestBmpSize.Height(); ++y ) { if( bModulateColors ) @@ -384,36 +384,36 @@ namespace vclcanvas // nAlphaModulation. This is a // little bit verbose, formula // is 255 - (255-pixAlpha)*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha + // (invert 'alpha' pixel value, + // to get the standard alpha // channel behaviour) - pAlphaWriteAccess->SetPixel( y, x, - BitmapColor( - 255U - + pAlphaWriteAccess->SetPixel( y, x, + BitmapColor( + 255U - static_cast<BYTE>( nAlphaModulation* (255U - - aAlphaMap[ pAlphaReadAccess->GetPixel( + - aAlphaMap[ pAlphaReadAccess->GetPixel( nSrcY, nSrcX ).GetIndex() ] ) + .5 ) ) ); BitmapColor aColor( pReadAccess->GetPixel( nSrcY, nSrcX ) ); - aColor.SetRed( + aColor.SetRed( static_cast<BYTE>( nRedModulation * aColor.GetRed() + .5 )); - aColor.SetGreen( + aColor.SetGreen( static_cast<BYTE>( nGreenModulation * aColor.GetGreen() + .5 )); - aColor.SetBlue( + aColor.SetBlue( static_cast<BYTE>( nBlueModulation * aColor.GetBlue() + .5 )); - pWriteAccess->SetPixel( y, x, + pWriteAccess->SetPixel( y, x, aColor ); } } @@ -438,12 +438,12 @@ namespace vclcanvas // nAlphaModulation. This is a // little bit verbose, formula // is 255 - 255*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha + // (invert 'alpha' pixel value, + // to get the standard alpha // channel behaviour) - pAlphaWriteAccess->SetPixel( y, x, - BitmapColor( - 255U - + pAlphaWriteAccess->SetPixel( y, x, + BitmapColor( + 255U - static_cast<BYTE>( nAlphaModulation*255.0 + .5 ) ) ); @@ -451,20 +451,20 @@ namespace vclcanvas BitmapColor aColor( pReadAccess->GetPixel( nSrcY, nSrcX ) ); - aColor.SetRed( + aColor.SetRed( static_cast<BYTE>( nRedModulation * aColor.GetRed() + .5 )); - aColor.SetGreen( + aColor.SetGreen( static_cast<BYTE>( nGreenModulation * aColor.GetGreen() + .5 )); - aColor.SetBlue( + aColor.SetBlue( static_cast<BYTE>( nBlueModulation * aColor.GetBlue() + .5 )); - pWriteAccess->SetPixel( y, x, + pWriteAccess->SetPixel( y, x, aColor ); } } @@ -491,8 +491,8 @@ namespace vclcanvas } else { - pAlphaWriteAccess->SetPixel( y, x, - aAlphaMap[ + pAlphaWriteAccess->SetPixel( y, x, + aAlphaMap[ pAlphaReadAccess->GetPixel( nSrcY, nSrcX ) ] ); @@ -531,7 +531,7 @@ namespace vclcanvas else { // TODO(E2): Error handling! - ENSURE_OR_THROW( false, + ENSURE_OR_THROW( false, "transformBitmap(): could not access bitmap" ); } } |