INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED
2004/11/23 23:20:13 thb 1.2.2.8: #110496# Regression: while avoiding ternary operators, due to a Solaris compiler bug, put part of the checked class initialization behind the checks. 2004/11/22 15:23:46 thb 1.2.2.7: #110496# Avoiding ternary operators returning different types on their branches: triggers Solaris compiler bug 2004/08/06 14:00:56 thb 1.2.2.6: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). 2004/07/22 18:43:59 thb 1.2.2.5: #110496# Explicitely hide sprites on destruction. Otherwise, the canvas will display them forever 2004/07/20 19:09:07 thb 1.2.2.4: #110496# Unified include statements; removed external prefix from boost includes 2004/06/25 10:30:31 thb 1.2.2.3: #110496# Some header cleanups (missing forward declarations), changed Canvas and derived to emulate covariant return types on clone() (not directly possible with shared_ptr) 2004/05/27 20:51:29 thb 1.2.2.2: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/04/05 15:58:54 thb 1.2.2.1: Resync with canvas01 changes
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: implsprite.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2004-03-18 10:41:12 $
|
||||
* last change: $Author: rt $ $Date: 2004-11-26 21:02:02 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -69,11 +69,15 @@
|
||||
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#endif
|
||||
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#endif
|
||||
#ifndef _CANVAS_CANVASTOOLS_HXX
|
||||
#include <canvas/canvastools.hxx>
|
||||
#endif
|
||||
|
||||
#include "implsprite.hxx"
|
||||
|
||||
#include <implsprite.hxx>
|
||||
|
||||
|
||||
using namespace ::drafts::com::sun::star;
|
||||
@@ -84,31 +88,56 @@ namespace cppcanvas
|
||||
namespace internal
|
||||
{
|
||||
|
||||
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
|
||||
const uno::Reference< rendering::XSprite >& rSprite ) :
|
||||
mxGraphicDevice( rParentCanvas.is() ? rParentCanvas->getDevice() : NULL ),
|
||||
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
|
||||
const uno::Reference< rendering::XSprite >& rSprite,
|
||||
const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter ) :
|
||||
mxGraphicDevice(),
|
||||
mxSprite( rSprite ),
|
||||
mxAnimatedSprite()
|
||||
mxAnimatedSprite(),
|
||||
mpTransformArbiter( rTransformArbiter )
|
||||
{
|
||||
// Avoiding ternary operator in initializer list (Solaris
|
||||
// compiler bug, when function call and temporary is
|
||||
// involved)
|
||||
if( rParentCanvas.is() )
|
||||
mxGraphicDevice = rParentCanvas->getDevice();
|
||||
|
||||
OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
|
||||
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
|
||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
|
||||
OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter");
|
||||
}
|
||||
|
||||
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
|
||||
const uno::Reference< rendering::XAnimatedSprite >& rSprite ) :
|
||||
mxGraphicDevice( rParentCanvas.is() ? rParentCanvas->getDevice() : NULL ),
|
||||
ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
|
||||
const uno::Reference< rendering::XAnimatedSprite >& rSprite,
|
||||
const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter ) :
|
||||
mxGraphicDevice(),
|
||||
mxSprite( uno::Reference< rendering::XSprite >(rSprite,
|
||||
uno::UNO_QUERY) ),
|
||||
mxAnimatedSprite( rSprite )
|
||||
mxAnimatedSprite( rSprite ),
|
||||
mpTransformArbiter( rTransformArbiter )
|
||||
{
|
||||
// Avoiding ternary operator in initializer list (Solaris
|
||||
// compiler bug, when function call and temporary is
|
||||
// involved)
|
||||
if( rParentCanvas.is() )
|
||||
mxGraphicDevice = rParentCanvas->getDevice();
|
||||
|
||||
OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
|
||||
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
|
||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
|
||||
OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter");
|
||||
}
|
||||
|
||||
ImplSprite::~ImplSprite()
|
||||
{
|
||||
// hide the sprite on the canvas. If we don't hide the
|
||||
// sprite, it will stay on the canvas forever, since the
|
||||
// canvas naturally keeps a list of visible sprites
|
||||
// (otherwise, it wouldn't be able to paint them
|
||||
// autonomously)
|
||||
if( mxSprite.is() )
|
||||
mxSprite->hide();
|
||||
}
|
||||
|
||||
void ImplSprite::setAlpha( const double& rAlpha )
|
||||
@@ -139,8 +168,23 @@ namespace cppcanvas
|
||||
|
||||
void ImplSprite::move( const ::basegfx::B2DPoint& rNewPos )
|
||||
{
|
||||
// TODO: Not yet implemented. Need reference to parent canvas here
|
||||
OSL_ENSURE( false, "ImplSprite::move(): Not yet implemented!");
|
||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::move(): Invalid sprite");
|
||||
|
||||
if( mxSprite.is() )
|
||||
{
|
||||
rendering::ViewState aViewState;
|
||||
rendering::RenderState aRenderState;
|
||||
|
||||
::canvas::tools::initViewState( aViewState );
|
||||
::canvas::tools::initRenderState( aRenderState );
|
||||
|
||||
::canvas::tools::setViewStateTransform( aViewState,
|
||||
mpTransformArbiter->getTransformation() );
|
||||
|
||||
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
|
||||
aViewState,
|
||||
aRenderState );
|
||||
}
|
||||
}
|
||||
|
||||
void ImplSprite::transform( const ::basegfx::B2DHomMatrix& rMatrix )
|
||||
@@ -156,6 +200,18 @@ namespace cppcanvas
|
||||
}
|
||||
}
|
||||
|
||||
void ImplSprite::setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly )
|
||||
{
|
||||
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
|
||||
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
|
||||
|
||||
if( mxSprite.is() && mxGraphicDevice.is() )
|
||||
{
|
||||
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
|
||||
rClipPoly ) );
|
||||
}
|
||||
}
|
||||
|
||||
void ImplSprite::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
|
||||
{
|
||||
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
|
||||
@@ -163,16 +219,19 @@ namespace cppcanvas
|
||||
|
||||
if( mxSprite.is() && mxGraphicDevice.is() )
|
||||
{
|
||||
rendering::ViewState aViewState;
|
||||
rendering::RenderState aRenderState;
|
||||
::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly );
|
||||
|
||||
::canvas::tools::initViewState( aViewState );
|
||||
::canvas::tools::initRenderState( aRenderState );
|
||||
// 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,
|
||||
rClipPoly ),
|
||||
aViewState,
|
||||
aRenderState );
|
||||
aTransformedClipPoly ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user