Kaydet (Commit) 3b8bf60a authored tarafından August Sodora's avatar August Sodora

Revert "callcatcher: Remove unused code"

This reverts commit 070eff8c.
üst d73d329b
...@@ -75,6 +75,7 @@ namespace cppcanvas ...@@ -75,6 +75,7 @@ namespace cppcanvas
coordinate space as the source polygon coordinate space as the source polygon
*/ */
PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const; 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 /** Create an uninitialized bitmap with the given size
*/ */
...@@ -84,6 +85,10 @@ namespace cppcanvas ...@@ -84,6 +85,10 @@ namespace cppcanvas
*/ */
BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const; 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: private:
friend struct InitInstance2; friend struct InitInstance2;
...@@ -95,6 +100,7 @@ namespace cppcanvas ...@@ -95,6 +100,7 @@ namespace cppcanvas
BaseGfxFactory(const BaseGfxFactory&); BaseGfxFactory(const BaseGfxFactory&);
BaseGfxFactory& operator=( const BaseGfxFactory& ); BaseGfxFactory& operator=( const BaseGfxFactory& );
}; };
} }
#endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */ #endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
......
...@@ -174,6 +174,9 @@ static float GetSwapFloat( SvStream& rSt ) ...@@ -174,6 +174,9 @@ static float GetSwapFloat( SvStream& rSt )
ImplRenderer( const CanvasSharedPtr& rCanvas, ImplRenderer( const CanvasSharedPtr& rCanvas,
const GDIMetaFile& rMtf, const GDIMetaFile& rMtf,
const Parameters& rParms ); const Parameters& rParms );
ImplRenderer( const CanvasSharedPtr& rCanvas,
const BitmapEx& rBmpEx,
const Parameters& rParms );
virtual ~ImplRenderer(); virtual ~ImplRenderer();
...@@ -207,8 +210,10 @@ static float GetSwapFloat( SvStream& rSt ) ...@@ -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 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 ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags = 0);
void MapToDevice (double &x, double &y); void MapToDevice (double &x, double &y);
::basegfx::B2DPoint Map (::basegfx::B2DPoint& p);
::basegfx::B2DPoint Map (double ix, double iy); ::basegfx::B2DPoint Map (double ix, double iy);
::basegfx::B2DSize MapSize (double iwidth, double iheight); ::basegfx::B2DSize MapSize (double iwidth, double iheight);
::basegfx::B2DRange MapRectangle (double ix, double iy, double iwidth, double iheight);
private: private:
// default: disabled copy/assignment // default: disabled copy/assignment
......
...@@ -825,6 +825,11 @@ namespace cppcanvas ...@@ -825,6 +825,11 @@ namespace cppcanvas
y = 100*nMmY*y/nPixY; 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) ::basegfx::B2DPoint ImplRenderer::Map (double ix, double iy)
{ {
double x, y; double x, y;
...@@ -858,6 +863,29 @@ namespace cppcanvas ...@@ -858,6 +863,29 @@ namespace cppcanvas
return ::basegfx::B2DSize (w, h); 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) \ #define COLOR(x) \
::vcl::unotools::colorToDoubleSequence( ::Color (0xff - (x >> 24), \ ::vcl::unotools::colorToDoubleSequence( ::Color (0xff - (x >> 24), \
(x >> 16) & 0xff, \ (x >> 16) & 0xff, \
......
...@@ -3074,6 +3074,54 @@ namespace cppcanvas ...@@ -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() ImplRenderer::~ImplRenderer()
{ {
} }
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "implbitmap.hxx" #include "implbitmap.hxx"
#include "impltext.hxx" #include "impltext.hxx"
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace cppcanvas namespace cppcanvas
...@@ -71,6 +72,48 @@ 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, BitmapSharedPtr BaseGfxFactory::createBitmap( const CanvasSharedPtr& rCanvas,
const ::basegfx::B2ISize& rSize ) const const ::basegfx::B2ISize& rSize ) const
{ {
...@@ -110,6 +153,13 @@ namespace cppcanvas ...@@ -110,6 +153,13 @@ namespace cppcanvas
xCanvas->getDevice()->createCompatibleAlphaBitmap( xCanvas->getDevice()->createCompatibleAlphaBitmap(
::basegfx::unotools::integerSize2DFromB2ISize(rSize) ) ) ); ::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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment