From a0888cbbaf73a13e2e2d41150f9806ec9e99996f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Fri, 26 Nov 2004 16:13:19 +0000 Subject: [PATCH] INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:31 thb 1.2.2.7: #118514# Canvas module reorg 2004/11/08 05:54:34 thb 1.2.2.6: #i36093#, #110496# Added native canvas gradients; improved bitmap performance by special-casing a few important formats; de-flickered full-content redraw, by performing that, too, in a bg VDev 2004/10/11 00:00:06 thb 1.2.2.5: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/08/03 19:45:37 thb 1.2.2.4: #110496# Changed vcl canvas to use B2DPolygons, and transforming clip polys before setting them 2004/07/20 19:23:56 thb 1.2.2.3: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:27 thb 1.2.2.2: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/04/05 15:57:59 thb 1.2.2.1: Resync with canvas01 changes --- canvas/source/vcl/impltools.hxx | 97 ++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 19 deletions(-) diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx index 92157cb6556f..c1986c33f502 100644 --- a/canvas/source/vcl/impltools.hxx +++ b/canvas/source/vcl/impltools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: impltools.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2004-03-18 10:38:42 $ + * last change: $Author: rt $ $Date: 2004-11-26 17:13:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,10 @@ #include #endif +#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX +#include +#endif + #ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ #include #endif @@ -83,6 +87,19 @@ #include #endif +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#include +#endif + +#include + +#include "outdevprovider.hxx" + + +class OutputDevice; +class Point; +class Size; + namespace basegfx { namespace matrix @@ -111,11 +128,15 @@ namespace com { namespace sun { namespace star { namespace drawing struct HomogenMatrix3; } } } } -namespace drafts { namespace com { namespace sun { namespace star { namespace rendering +namespace drafts { namespace com { namespace sun { namespace star { namespace geometry { struct RealPoint2D; struct RealSize2D; struct RealRectangle2D; +} } } } } + +namespace drafts { namespace com { namespace sun { namespace star { namespace rendering +{ struct RenderState; struct ViewState; class XCanvas; @@ -128,7 +149,7 @@ namespace vclcanvas { namespace tools { - ::PolyPolygon + ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XPolyPolygon2D >& ); @@ -136,10 +157,15 @@ namespace vclcanvas bitmapExFromXBitmap( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XBitmap >& ); - ::Point setupFontTransform( ::Font& aVCLFont, - const ::drafts::com::sun::star::rendering::ViewState& viewState, - const ::drafts::com::sun::star::rendering::RenderState& renderState, - ::OutputDevice& rOutDev ); + /** Setup VCL font and output position + + @returns false, if no text output should happen + */ + bool setupFontTransform( ::Point& o_rPoint, + ::Font& io_rVCLFont, + const ::drafts::com::sun::star::rendering::ViewState& viewState, + const ::drafts::com::sun::star::rendering::RenderState& renderState, + ::OutputDevice& rOutDev ); // Little helper to encapsulate locking into policy class @@ -151,6 +177,12 @@ namespace vclcanvas { } + /// To be compatible with CanvasBase mutex concept + LocalGuard( const ::osl::Mutex& ) : + aGuard( Application::GetSolarMutex() ) + { + } + private: ::vos::OGuard aGuard; }; @@ -158,36 +190,63 @@ namespace vclcanvas class OutDevStateKeeper { public: + typedef ::boost::shared_ptr< canvas::vcltools::VCLObject< OutputDevice > > OutputDeviceSharedPtr; + explicit OutDevStateKeeper( OutputDevice& rOutDev ) : - mrOutDev( rOutDev ), - mbMappingWasEnable( rOutDev.IsMapModeEnabled() ) + mpOutDev( &rOutDev ), + mbMappingWasEnabled( mpOutDev->IsMapModeEnabled() ) { - mrOutDev.Push(); - mrOutDev.EnableMapMode(FALSE); + init(); + } + + explicit OutDevStateKeeper( const OutDevProviderSharedPtr& rOutDev ) : + mpOutDev( rOutDev.get() ? &(rOutDev->getOutDev()) : NULL ), + mbMappingWasEnabled( mpOutDev ? mpOutDev->IsMapModeEnabled() : false ) + { + init(); } ~OutDevStateKeeper() { - mrOutDev.EnableMapMode( mbMappingWasEnable ); - mrOutDev.Pop(); + if( mpOutDev ) + { + mpOutDev->EnableMapMode( mbMappingWasEnabled ); + mpOutDev->Pop(); + } } private: - OutputDevice& mrOutDev; - const bool mbMappingWasEnable; + void init() + { + if( mpOutDev ) + { + mpOutDev->Push(); + mpOutDev->EnableMapMode(FALSE); + } + } + + OutputDevice* mpOutDev; + const bool mbMappingWasEnabled; }; ::Point mapRealPoint2D( const ::drafts::com::sun::star::geometry::RealPoint2D& rPoint, const ::drafts::com::sun::star::rendering::ViewState& rViewState, const ::drafts::com::sun::star::rendering::RenderState& rRenderState ); - ::PolyPolygon mapPolyPolygon( const ::PolyPolygon& rPoly, + ::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, const ::drafts::com::sun::star::rendering::ViewState& rViewState, const ::drafts::com::sun::star::rendering::RenderState& rRenderState ); - ::BitmapEx transformBitmap( const BitmapEx& rBitmap, + enum ModulationMode + { + MODULATE_NONE, + MODULATE_WITH_DEVICECOLOR + }; + + ::BitmapEx transformBitmap( const BitmapEx& rBitmap, const ::drafts::com::sun::star::rendering::ViewState& rViewState, - const ::drafts::com::sun::star::rendering::RenderState& rRenderState ); + const ::drafts::com::sun::star::rendering::RenderState& rRenderState, + ModulationMode eModulationMode=MODULATE_NONE ); } }