diff options
author | August Sodora <augsod@gmail.com> | 2011-12-21 06:46:40 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2011-12-21 06:46:56 -0500 |
commit | 3b8bf60a040d51d2d228127693f0b9c3292b151d (patch) | |
tree | ae6d6a79c6d71fff923ef0ad4a5a4202bda55328 /cppcanvas | |
parent | d73d329bf1a114bb5e26742245aac9abb6dae269 (diff) |
Revert "callcatcher: Remove unused code"
This reverts commit 070eff8cf1ad7763b8b730336f11032893b77049.
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/inc/cppcanvas/basegfxfactory.hxx | 6 | ||||
-rw-r--r-- | cppcanvas/source/inc/implrenderer.hxx | 5 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 28 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 48 | ||||
-rw-r--r-- | cppcanvas/source/wrapper/basegfxfactory.cxx | 50 |
5 files changed, 137 insertions, 0 deletions
diff --git a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx index dbb8d1221f64..5cb87aaeb5d3 100644 --- a/cppcanvas/inc/cppcanvas/basegfxfactory.hxx +++ b/cppcanvas/inc/cppcanvas/basegfxfactory.hxx @@ -75,6 +75,7 @@ namespace cppcanvas coordinate space as the source polygon */ PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const; + PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolyPolygon& rPoly ) const; /** Create an uninitialized bitmap with the given size */ @@ -84,6 +85,10 @@ namespace cppcanvas */ BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const; + /** Create a text portion with the given content string + */ + TextSharedPtr createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const; + private: friend struct InitInstance2; @@ -95,6 +100,7 @@ namespace cppcanvas BaseGfxFactory(const BaseGfxFactory&); BaseGfxFactory& operator=( const BaseGfxFactory& ); }; + } #endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */ diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index edf69be14a86..3c1ec6de127f 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -174,6 +174,9 @@ static float GetSwapFloat( SvStream& rSt ) ImplRenderer( const CanvasSharedPtr& rCanvas, const GDIMetaFile& rMtf, const Parameters& rParms ); + ImplRenderer( const CanvasSharedPtr& rCanvas, + const BitmapEx& rBmpEx, + const Parameters& rParms ); virtual ~ImplRenderer(); @@ -207,8 +210,10 @@ static float GetSwapFloat( SvStream& rSt ) void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags = 0); void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags = 0); void MapToDevice (double &x, double &y); + ::basegfx::B2DPoint Map (::basegfx::B2DPoint& p); ::basegfx::B2DPoint Map (double ix, double iy); ::basegfx::B2DSize MapSize (double iwidth, double iheight); + ::basegfx::B2DRange MapRectangle (double ix, double iy, double iwidth, double iheight); private: // default: disabled copy/assignment diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 8ccb75bfdad1..91c95607a055 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -825,6 +825,11 @@ namespace cppcanvas y = 100*nMmY*y/nPixY; } + ::basegfx::B2DPoint ImplRenderer::Map (::basegfx::B2DPoint& p) + { + return Map (p.getX (), p.getY ()); + } + ::basegfx::B2DPoint ImplRenderer::Map (double ix, double iy) { double x, y; @@ -858,6 +863,29 @@ namespace cppcanvas return ::basegfx::B2DSize (w, h); } + ::basegfx::B2DRange ImplRenderer::MapRectangle (double ix, double iy, double iwidth, double iheight) + { + double x, y, w, h; + + x = ix*aWorldTransform.eM11 + iy*aWorldTransform.eM21 + aWorldTransform.eDx; + y = ix*aWorldTransform.eM12 + iy*aWorldTransform.eM22 + aWorldTransform.eDy; + w = iwidth*aWorldTransform.eM11 + iheight*aWorldTransform.eM21; + h = iwidth*aWorldTransform.eM12 + iheight*aWorldTransform.eM22; + + MapToDevice (x, y); + MapToDevice (w, h); + + x -= nFrameLeft; + y -= nFrameTop; + + x *= aBaseTransform.eM11; + y *= aBaseTransform.eM22; + w *= aBaseTransform.eM11; + h *= aBaseTransform.eM22; + + return ::basegfx::B2DRange (x, y, x + w, y + h); + } + #define COLOR(x) \ ::vcl::unotools::colorToDoubleSequence( ::Color (0xff - (x >> 24), \ (x >> 16) & 0xff, \ diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8dde2f087c8d..65b9d21a37ee 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -3074,6 +3074,54 @@ namespace cppcanvas ); } + ImplRenderer::ImplRenderer( const CanvasSharedPtr& rCanvas, + const BitmapEx& rBmpEx, + const Parameters& rParams ) : + CanvasGraphicHelper( rCanvas ), + maActions() + { + // TODO(F3): property modification parameters are + // currently ignored for Bitmaps + (void)rParams; + + RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::ImplRenderer::ImplRenderer(bitmap)" ); + + OSL_ENSURE( rCanvas.get() != NULL && rCanvas->getUNOCanvas().is(), + "ImplRenderer::ImplRenderer(): Invalid canvas" ); + OSL_ENSURE( rCanvas->getUNOCanvas()->getDevice().is(), + "ImplRenderer::ImplRenderer(): Invalid graphic device" ); + + // make sure canvas and graphic device are valid; action + // creation don't check that every time + if( rCanvas.get() == NULL || + !rCanvas->getUNOCanvas().is() || + !rCanvas->getUNOCanvas()->getDevice().is() ) + { + // leave actions empty + return; + } + + OutDevState aState; + + const Size aBmpSize( rBmpEx.GetSizePixel() ); + + // Setup local state, such that the bitmap renders itself + // into a one-by-one square for identity view and render + // transformations + aState.transform.scale( 1.0 / aBmpSize.Width(), + 1.0 / aBmpSize.Height() ); + + // create a single action for the provided BitmapEx + maActions.push_back( + MtfAction( + BitmapActionFactory::createBitmapAction( + rBmpEx, + ::basegfx::B2DPoint(), + rCanvas, + aState), + 0 ) ); + } + ImplRenderer::~ImplRenderer() { } diff --git a/cppcanvas/source/wrapper/basegfxfactory.cxx b/cppcanvas/source/wrapper/basegfxfactory.cxx index d8dedb37eab4..bac25aa1d9d4 100644 --- a/cppcanvas/source/wrapper/basegfxfactory.cxx +++ b/cppcanvas/source/wrapper/basegfxfactory.cxx @@ -43,6 +43,7 @@ #include "implbitmap.hxx" #include "impltext.hxx" + using namespace ::com::sun::star; namespace cppcanvas @@ -71,6 +72,48 @@ namespace cppcanvas { } + PolyPolygonSharedPtr BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas, + const ::basegfx::B2DPolygon& rPoly ) const + { + OSL_ENSURE( rCanvas.get() != NULL && + rCanvas->getUNOCanvas().is(), + "BaseGfxFactory::createPolyPolygon(): Invalid canvas" ); + + if( rCanvas.get() == NULL ) + return PolyPolygonSharedPtr(); + + uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() ); + if( !xCanvas.is() ) + return PolyPolygonSharedPtr(); + + return PolyPolygonSharedPtr( + new internal::ImplPolyPolygon( rCanvas, + ::basegfx::unotools::xPolyPolygonFromB2DPolygon( + xCanvas->getDevice(), + rPoly) ) ); + } + + PolyPolygonSharedPtr BaseGfxFactory::createPolyPolygon( const CanvasSharedPtr& rCanvas, + const ::basegfx::B2DPolyPolygon& rPolyPoly ) const + { + OSL_ENSURE( rCanvas.get() != NULL && + rCanvas->getUNOCanvas().is(), + "BaseGfxFactory::createPolyPolygon(): Invalid canvas" ); + + if( rCanvas.get() == NULL ) + return PolyPolygonSharedPtr(); + + uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() ); + if( !xCanvas.is() ) + return PolyPolygonSharedPtr(); + + return PolyPolygonSharedPtr( + new internal::ImplPolyPolygon( rCanvas, + ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + xCanvas->getDevice(), + rPolyPoly) ) ); + } + BitmapSharedPtr BaseGfxFactory::createBitmap( const CanvasSharedPtr& rCanvas, const ::basegfx::B2ISize& rSize ) const { @@ -110,6 +153,13 @@ namespace cppcanvas xCanvas->getDevice()->createCompatibleAlphaBitmap( ::basegfx::unotools::integerSize2DFromB2ISize(rSize) ) ) ); } + + TextSharedPtr BaseGfxFactory::createText( const CanvasSharedPtr& rCanvas, const ::rtl::OUString& rText ) const + { + return TextSharedPtr( new internal::ImplText( rCanvas, + rText ) ); + } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |