diff options
author | Oliver Bolte <obo@openoffice.org> | 2007-07-17 14:27:11 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2007-07-17 14:27:11 +0000 |
commit | 6bf80552f3f4486d5254c57e65f4f6e30e147d4a (patch) | |
tree | 028509dfce79e2ddf093d7633185aa808b5997a8 | |
parent | 3e7cc5d8f1e21af1a1053d7e01735a74fe26deb5 (diff) |
INTEGRATION: CWS presfixes12 (1.8.22); FILE MERGED
2007/03/08 21:37:08 thb 1.8.22.1: #i37778# Added extra setClip() method to be able to set no clip - setting a clip with zero polygons by definition clips everything
-rw-r--r-- | cppcanvas/source/wrapper/implsprite.cxx | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx index 602d0f97f427..110cbba8613c 100644 --- a/cppcanvas/source/wrapper/implsprite.cxx +++ b/cppcanvas/source/wrapper/implsprite.cxx @@ -4,9 +4,9 @@ * * $RCSfile: implsprite.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: obo $ $Date: 2006-09-17 12:53:06 $ + * last change: $Author: obo $ $Date: 2007-07-17 15:27:11 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -182,13 +182,8 @@ namespace cppcanvas OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite"); if( mxSprite.is() && mxGraphicDevice.is() ) - { - if( rClipPoly.count() == 0 ) - mxSprite->clip( uno::Reference< rendering::XPolyPolygon2D >() ); - else - mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice, + mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice, rClipPoly ) ); - } } void ImplSprite::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) @@ -198,29 +193,31 @@ namespace cppcanvas if( mxSprite.is() && mxGraphicDevice.is() ) { - if( rClipPoly.count() == 0 ) - { - mxSprite->clip( uno::Reference< rendering::XPolyPolygon2D >() ); - } - else - { - ::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly ); - - // extract linear part of canvas view transformation (linear means: - // without translational components) - ::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() ); - aViewTransform.set( 0, 2, 0.0 ); - aViewTransform.set( 1, 2, 0.0 ); - - // transform polygon from view to device coordinate space - aTransformedClipPoly.transform( aViewTransform ); - - mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice, - aTransformedClipPoly ) ); - } + ::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly ); + + // extract linear part of canvas view transformation (linear means: + // without translational components) + ::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() ); + aViewTransform.set( 0, 2, 0.0 ); + aViewTransform.set( 1, 2, 0.0 ); + + // transform polygon from view to device coordinate space + aTransformedClipPoly.transform( aViewTransform ); + + mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice, + aTransformedClipPoly ) ); } } + void ImplSprite::setClip() + { + OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas"); + OSL_ENSURE( mxSprite.is(), "ImplSprite::setClip(): Invalid sprite"); + + if( mxSprite.is() && mxGraphicDevice.is() ) + mxSprite->clip( uno::Reference< rendering::XPolyPolygon2D >() ); + } + void ImplSprite::show() { OSL_ENSURE( mxSprite.is(), "ImplSprite::show(): Invalid sprite"); |