summaryrefslogtreecommitdiff
path: root/canvas/source
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2010-01-18 01:10:42 +0100
committerthb <thb@openoffice.org>2010-01-18 01:10:42 +0100
commitea48c18b848fed4d6504c956adeb3f24f05938ca (patch)
tree1eccf884707ec16e4dd74f8e83c74563e1539b34 /canvas/source
parent1737f4d2fdba50a590f76631cd7ca7e762d18c35 (diff)
parent8765a3bf9f2926a50d0f644e4263782269abe023 (diff)
thbfixes10: merge with DEV300 m69
Diffstat (limited to 'canvas/source')
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx50
-rw-r--r--canvas/source/cairo/cairo_canvashelper.hxx1
-rwxr-xr-xcanvas/source/directx/dx_9rm.cxx42
-rwxr-xr-xcanvas/source/directx/dx_canvashelper.cxx24
-rwxr-xr-xcanvas/source/directx/dx_canvashelper_texturefill.cxx4
-rwxr-xr-xcanvas/source/directx/dx_config.cxx3
-rw-r--r--canvas/source/directx/dx_config.hxx2
-rwxr-xr-xcanvas/source/directx/dx_impltools.cxx67
-rwxr-xr-xcanvas/source/directx/dx_impltools.hxx15
-rwxr-xr-xcanvas/source/directx/dx_linepolypolygon.cxx4
-rwxr-xr-xcanvas/source/directx/dx_linepolypolygon.hxx2
-rwxr-xr-xcanvas/source/directx/dx_surfacegraphics.cxx5
-rw-r--r--canvas/source/simplecanvas/simplecanvasimpl.cxx11
-rw-r--r--canvas/source/tools/canvastools.cxx11
-rw-r--r--canvas/source/tools/surface.cxx11
15 files changed, 189 insertions, 63 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 7e373d3bfe1d..f0ba4067f899 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1047,6 +1047,7 @@ namespace cairocanvas
void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
Operation aOperation,
+ bool bNoLineJoin,
const uno::Sequence< rendering::Texture >* pTextures,
Cairo* pCairo ) const
{
@@ -1056,10 +1057,46 @@ namespace cairocanvas
if( !pCairo )
pCairo = mpCairo.get();
- doPolyPolygonImplementation( rPolyPoly, aOperation,
- pCairo, pTextures,
- mpSurfaceProvider,
- xPolyPolygon->getFillRule() );
+ if(bNoLineJoin && Stroke == aOperation)
+ {
+ // emulate rendering::PathJoinType::NONE by painting single edges
+ for(sal_uInt32 a(0); a < rPolyPoly.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(rPolyPoly.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount)
+ {
+ const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1: nPointCount);
+ basegfx::B2DPolygon aEdge;
+ aEdge.append(aCandidate.getB2DPoint(0));
+ aEdge.append(basegfx::B2DPoint(0.0, 0.0));
+
+ for(sal_uInt32 a(0); a < nEdgeCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex));
+ aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a));
+ aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex));
+
+ doPolyPolygonImplementation( aEdge, aOperation,
+ pCairo, pTextures,
+ mpSurfaceProvider,
+ xPolyPolygon->getFillRule() );
+
+ // prepare next step
+ aEdge.setB2DPoint(0, aEdge.getB2DPoint(1));
+ }
+ }
+ }
+ }
+ else
+ {
+ doPolyPolygonImplementation( rPolyPoly, aOperation,
+ pCairo, pTextures,
+ mpSurfaceProvider,
+ xPolyPolygon->getFillRule() );
+ }
}
uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* ,
@@ -1128,9 +1165,12 @@ namespace cairocanvas
break;
}
+ bool bNoLineJoin(false);
+
switch( strokeAttributes.JoinType ) {
// cairo doesn't have join type NONE so we use MITER as it's pretty close
case rendering::PathJoinType::NONE:
+ bNoLineJoin = true;
case rendering::PathJoinType::MITER:
cairo_set_line_join( mpCairo.get(), CAIRO_LINE_JOIN_MITER );
break;
@@ -1152,7 +1192,7 @@ namespace cairocanvas
// TODO(rodo) use LineArray of strokeAttributes
- doPolyPolygonPath( xPolyPolygon, Stroke );
+ doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin );
cairo_restore( mpCairo.get() );
} else
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index 1e69a9f41e5b..90d365d63b3c 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -276,6 +276,7 @@ namespace cairocanvas
void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
Operation aOperation,
+ bool bNoLineJoin = false,
const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL,
::cairo::Cairo* pCairo=NULL ) const;
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index 932a15e1f5c1..acef323ddc1b 100755
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -956,11 +956,43 @@ namespace dxcanvas
{
if(hr != D3DERR_DEVICELOST)
return false;
- hr = mpDevice->Reset(&mad3dpp);
- if(SUCCEEDED(hr))
- return true;
- if(hr == D3DERR_DEVICELOST)
- return true;
+
+ // interestingly enough, sometimes the Reset() below
+ // *still* causes DeviceLost errors. So, cycle until
+ // DX was kind enough to really reset the device...
+ do
+ {
+ mpVertexBuffer.reset();
+ hr = mpDevice->Reset(&mad3dpp);
+ if(SUCCEEDED(hr))
+ {
+ IDirect3DVertexBuffer9 *pVB(NULL);
+ DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
+ if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
+ D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
+ aFVF,
+ D3DPOOL_DEFAULT,
+ &pVB,
+ NULL)) )
+ {
+ throw lang::NoSupportException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create DirectX device - out of memory!")),NULL);
+ }
+ mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
+
+ // retry after the restore
+ if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)))
+ return true;
+ }
+
+ TimeValue aTimeout;
+ aTimeout.Seconds=1;
+ aTimeout.Nanosec=0;
+ osl_waitThread(&aTimeout);
+ }
+ while(hr == D3DERR_DEVICELOST);
+
return false;
}
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx
index 0642b6c50efb..607f7c076e21 100755
--- a/canvas/source/directx/dx_canvashelper.cxx
+++ b/canvas/source/directx/dx_canvashelper.cxx
@@ -46,6 +46,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <comphelper/sequence.hxx>
#include <canvas/canvastools.hxx>
@@ -367,7 +368,11 @@ namespace dxcanvas
pGraphics->GetPixelOffsetMode() );
pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone );
- aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
+ const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType);
+ const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType);
+
+ if(bIsMiter)
+ aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
const ::std::vector< Gdiplus::REAL >& rDashArray(
::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >(
@@ -380,9 +385,10 @@ namespace dxcanvas
aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType),
gdiCapFromCap(strokeAttributes.EndCapType),
Gdiplus::DashCapFlat );
- aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
+ if(!bIsNone)
+ aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
- GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) );
+ GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon, bIsNone ) );
// TODO(E1): Return value
Gdiplus::Status hr = pGraphics->DrawPath( &aPen, pPath.get() );
@@ -733,10 +739,8 @@ namespace dxcanvas
// add output offset
if( !maOutputOffset.equalZero() )
{
- ::basegfx::B2DHomMatrix aOutputOffset;
- aOutputOffset.translate( maOutputOffset.getX(),
- maOutputOffset.getY() );
-
+ const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix(
+ maOutputOffset.getX(), maOutputOffset.getY()));
aTransform = aOutputOffset * aTransform;
}
@@ -774,10 +778,8 @@ namespace dxcanvas
// add output offset
if( !maOutputOffset.equalZero() )
{
- ::basegfx::B2DHomMatrix aOutputOffset;
- aOutputOffset.translate( maOutputOffset.getX(),
- maOutputOffset.getY() );
-
+ const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix(
+ maOutputOffset.getX(), maOutputOffset.getY()));
aTransform = aOutputOffset * aTransform;
}
diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx
index 6fc257d92c9f..d0ebaf2f2fc9 100755
--- a/canvas/source/directx/dx_canvashelper_texturefill.cxx
+++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx
@@ -43,6 +43,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/tools/tools.hxx>
#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <canvas/parametricpolypolygon.hxx>
@@ -452,8 +453,7 @@ namespace dxcanvas
aFillBrush.SetColor( aFillColor );
const double nCurrScale( (nStepCount-i)/(double)nStepCount );
- aScaleMatrix.identity();
- aScaleMatrix.translate( -0.5, -0.5 );
+ aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5);
// handle anisotrophic polygon scaling
if( rValues.mnAspectRatio < 1.0 )
diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx
index 48f44e3ba816..e124d4d78e6a 100755
--- a/canvas/source/directx/dx_config.cxx
+++ b/canvas/source/directx/dx_config.cxx
@@ -144,6 +144,9 @@ namespace dxcanvas
}
}
+ void DXCanvasItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) {}
+ void DXCanvasItem::Commit() {}
+
bool DXCanvasItem::isDeviceUsable( const DeviceInfo& rDeviceInfo ) const
{
return maValues.find(rDeviceInfo) == maValues.end();
diff --git a/canvas/source/directx/dx_config.hxx b/canvas/source/directx/dx_config.hxx
index 34deddb509a7..1fffcb2ed56e 100644
--- a/canvas/source/directx/dx_config.hxx
+++ b/canvas/source/directx/dx_config.hxx
@@ -77,6 +77,8 @@ namespace dxcanvas
bool isBlacklistCurrentDevice() const;
void blacklistDevice( const DeviceInfo& rDeviceInfo );
void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const;
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+ virtual void Commit();
private:
typedef std::set< DeviceInfo > ValueSet;
diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx
index 40164c9a1d87..4f5b92d6bcb5 100755
--- a/canvas/source/directx/dx_impltools.cxx
+++ b/canvas/source/directx/dx_impltools.cxx
@@ -194,7 +194,8 @@ namespace dxcanvas
void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr& rOutput,
::std::vector< Gdiplus::PointF >& rPoints,
- const ::basegfx::B2DPolygon& rPoly )
+ const ::basegfx::B2DPolygon& rPoly,
+ bool bNoLineJoin)
{
const sal_uInt32 nPoints( rPoly.count() );
@@ -241,7 +242,18 @@ namespace dxcanvas
rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()),
static_cast<Gdiplus::REAL>(rPoint.getY()) );
- rOutput->AddBeziers( &rPoints[0], nCurrOutput );
+ if(bNoLineJoin && nCurrOutput > 7)
+ {
+ for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
+ {
+ rOutput->StartFigure();
+ rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
+ }
+ }
+ else
+ {
+ rOutput->AddBeziers( &rPoints[0], nCurrOutput );
+ }
}
else
{
@@ -251,7 +263,20 @@ namespace dxcanvas
// Therefore, simply don't pass the last two
// points here.
if( nCurrOutput > 3 )
- rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
+ {
+ if(bNoLineJoin && nCurrOutput > 7)
+ {
+ for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
+ {
+ rOutput->StartFigure();
+ rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
+ }
+ }
+ else
+ {
+ rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
+ }
+ }
}
}
else
@@ -267,10 +292,27 @@ namespace dxcanvas
static_cast<Gdiplus::REAL>(rPoint.getY()) );
}
- rOutput->AddLines( &rPoints[0], nPoints );
+ if(bNoLineJoin && nPoints > 2)
+ {
+ for(sal_uInt32 a(1); a < nPoints; a++)
+ {
+ rOutput->StartFigure();
+ rOutput->AddLine(rPoints[a - 1], rPoints[a]);
+ }
+
+ if(bClosedPolygon)
+ {
+ rOutput->StartFigure();
+ rOutput->AddLine(rPoints[nPoints - 1], rPoints[0]);
+ }
+ }
+ else
+ {
+ rOutput->AddLines( &rPoints[0], nPoints );
+ }
}
- if( bClosedPolygon )
+ if( bClosedPolygon && !bNoLineJoin )
rOutput->CloseFigure();
}
}
@@ -426,17 +468,17 @@ namespace dxcanvas
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly )
+ GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin )
{
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
::std::vector< Gdiplus::PointF > aPoints;
- graphicsPathFromB2DPolygon( pRes, aPoints, rPoly );
+ graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin );
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly )
+ GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin )
{
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
::std::vector< Gdiplus::PointF > aPoints;
@@ -446,24 +488,25 @@ namespace dxcanvas
{
graphicsPathFromB2DPolygon( pRes,
aPoints,
- rPoly.getB2DPolygon( nCurrPoly ) );
+ rPoly.getB2DPolygon( nCurrPoly ),
+ bNoLineJoin);
}
return pRes;
}
- GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
+ GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly, bool bNoLineJoin )
{
LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() );
if( pPolyImpl )
{
- return pPolyImpl->getGraphicsPath();
+ return pPolyImpl->getGraphicsPath( bNoLineJoin );
}
else
{
return tools::graphicsPathFromB2DPolyPolygon(
- polyPolygonFromXPolyPolygon2D( xPoly ) );
+ polyPolygonFromXPolyPolygon2D( xPoly ), bNoLineJoin );
}
}
diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx
index 072d1063235d..222b1a927305 100755
--- a/canvas/source/directx/dx_impltools.hxx
+++ b/canvas/source/directx/dx_impltools.hxx
@@ -107,11 +107,18 @@ namespace dxcanvas
GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& );
- GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly );
- GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly );
+ GraphicsPathSharedPtr graphicsPathFromB2DPolygon(
+ const ::basegfx::B2DPolygon& rPoly,
+ bool bNoLineJoin = false);
+
+ GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(
+ const ::basegfx::B2DPolyPolygon& rPoly,
+ bool bNoLineJoin = false);
+
+ GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&,
+ bool bNoLineJoin = false );
- GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XPolyPolygon2D >& );
bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
const BitmapSharedPtr& rBitmap );
bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
diff --git a/canvas/source/directx/dx_linepolypolygon.cxx b/canvas/source/directx/dx_linepolypolygon.cxx
index e63adc3dc613..9a5569384eae 100755
--- a/canvas/source/directx/dx_linepolypolygon.cxx
+++ b/canvas/source/directx/dx_linepolypolygon.cxx
@@ -46,14 +46,14 @@ namespace dxcanvas
{
}
- GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath() const
+ GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const
{
// generate GraphicsPath only on demand (gets deleted as soon
// as any of the modifying methods above touches the
// B2DPolyPolygon).
if( !mpPath )
{
- mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe() );
+ mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin );
mpPath->SetFillMode( const_cast<LinePolyPolygon*>(this)->getFillRule() == rendering::FillRule_EVEN_ODD ?
Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding );
}
diff --git a/canvas/source/directx/dx_linepolypolygon.hxx b/canvas/source/directx/dx_linepolypolygon.hxx
index 431cd1b87b4f..3e061d76e768 100755
--- a/canvas/source/directx/dx_linepolypolygon.hxx
+++ b/canvas/source/directx/dx_linepolypolygon.hxx
@@ -45,7 +45,7 @@ namespace dxcanvas
public:
explicit LinePolyPolygon( const ::basegfx::B2DPolyPolygon& );
- GraphicsPathSharedPtr getGraphicsPath() const;
+ GraphicsPathSharedPtr getGraphicsPath( bool bNoLineJoin = false) const;
private:
// overridden, to clear mpPath
diff --git a/canvas/source/directx/dx_surfacegraphics.cxx b/canvas/source/directx/dx_surfacegraphics.cxx
index 128095c1315d..8b9af6be6827 100755
--- a/canvas/source/directx/dx_surfacegraphics.cxx
+++ b/canvas/source/directx/dx_surfacegraphics.cxx
@@ -34,6 +34,8 @@
#include "dx_surfacegraphics.hxx"
#include "dx_impltools.hxx"
+using namespace ::com::sun::star;
+
namespace dxcanvas
{
namespace
@@ -75,11 +77,12 @@ namespace dxcanvas
tools::setupGraphics( *pGraphics );
pRet.reset(pGraphics,
GraphicsDeleter(rSurface, aHDC));
+ return pRet;
}
else
rSurface->ReleaseDC( aHDC );
}
- return pRet;
+ throw uno::RuntimeException();
}
}
diff --git a/canvas/source/simplecanvas/simplecanvasimpl.cxx b/canvas/source/simplecanvas/simplecanvasimpl.cxx
index 185979b0220e..7ca251458d22 100644
--- a/canvas/source/simplecanvas/simplecanvasimpl.cxx
+++ b/canvas/source/simplecanvas/simplecanvasimpl.cxx
@@ -46,6 +46,7 @@
#include <comphelper/servicedecl.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include "canvas/canvastools.hxx"
@@ -287,10 +288,7 @@ namespace
::sal_Int8 nTextDirection ) throw (uno::RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
-
- basegfx::B2DHomMatrix offsetTransform;
- offsetTransform.translate(aOutPos.X,aOutPos.Y);
-
+ const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aOutPos.X,aOutPos.Y));
rendering::RenderState aRenderState( createStrokingRenderState() );
tools::appendToRenderState(aRenderState, offsetTransform);
@@ -305,10 +303,7 @@ namespace
const geometry::RealPoint2D& aLeftTop ) throw (uno::RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
-
- basegfx::B2DHomMatrix offsetTransform;
- offsetTransform.translate(aLeftTop.X,aLeftTop.Y);
-
+ const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aLeftTop.X,aLeftTop.Y));
rendering::RenderState aRenderState( createStrokingRenderState() );
tools::appendToRenderState(aRenderState, offsetTransform);
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 23d6124e4cb8..278789637c72 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -63,6 +63,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <cppuhelper/compbase1.hxx>
#include <rtl/instance.hxx>
@@ -679,9 +680,8 @@ namespace canvas
i_transformation );
// now move resulting left,top point of bounds to (0,0)
- ::basegfx::B2DHomMatrix aCorrectedTransform;
- aCorrectedTransform.translate( -aTransformedRect.getMinX(),
- -aTransformedRect.getMinY() );
+ const basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aTransformedRect.getMinX(), -aTransformedRect.getMinY()));
// prepend to original transformation
o_transform = aCorrectedTransform * i_transformation;
@@ -745,9 +745,8 @@ namespace canvas
transformation );
// now move resulting left,top point of bounds to (0,0)
- ::basegfx::B2DHomMatrix aCorrectedTransform;
- aCorrectedTransform.translate( -aTransformedRect.getMinX(),
- -aTransformedRect.getMinY() );
+ basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aTransformedRect.getMinX(), -aTransformedRect.getMinY()));
// scale to match outRect
const double xDenom( aTransformedRect.getWidth() );
diff --git a/canvas/source/tools/surface.cxx b/canvas/source/tools/surface.cxx
index c3161758ea3e..96162f6d78af 100644
--- a/canvas/source/tools/surface.cxx
+++ b/canvas/source/tools/surface.cxx
@@ -33,6 +33,7 @@
#include "surface.hxx"
#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <comphelper/scopeguard.hxx>
#include <boost/bind.hpp>
@@ -150,9 +151,8 @@ namespace canvas
// 4) scale to normalized device coordinates
// 5) flip y-axis
// 6) translate to account for viewport transform
- ::basegfx::B2DHomMatrix aTransform;
- aTransform.translate(maSourceOffset.getX(),
- maSourceOffset.getY());
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ maSourceOffset.getX(), maSourceOffset.getY()));
aTransform = aTransform * rTransform;
aTransform.translate(::basegfx::fround(rPos.getX()),
::basegfx::fround(rPos.getY()));
@@ -277,8 +277,7 @@ namespace canvas
// 1) offset of surface subarea
// 2) surface transform
// 3) translation to output position [rPos]
- ::basegfx::B2DHomMatrix aTransform;
- aTransform.translate(aPos1.getX(),aPos1.getY());
+ basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(aPos1.getX(), aPos1.getY()));
aTransform = aTransform * rTransform;
aTransform.translate(::basegfx::fround(rPos.getX()),
::basegfx::fround(rPos.getY()));
@@ -380,7 +379,7 @@ namespace canvas
// be transformed by the overall transform and uv coordinates will
// be calculated from the result, and this is why we need to use
// integer coordinates here...
- ::basegfx::B2DHomMatrix aTransform;
+ basegfx::B2DHomMatrix aTransform;
aTransform = aTransform * rTransform;
aTransform.translate(::basegfx::fround(rPos.getX()),
::basegfx::fround(rPos.getY()));