1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <canvas/debug.hxx>
23 #include <canvas/verbosetrace.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <tools/diagnose_ex.h>
27 #include <rtl/math.hxx>
29 #include <canvas/canvastools.hxx>
31 #include <basegfx/matrix/b2dhommatrix.hxx>
32 #include <basegfx/point/b2dpoint.hxx>
34 #include "dx_canvascustomsprite.hxx"
35 #include "dx_spritecanvas.hxx"
36 #include "dx_impltools.hxx"
38 using namespace ::com::sun::star
;
42 CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D
& rSpriteSize
,
43 const SpriteCanvasRef
& rRefDevice
,
44 const IDXRenderModuleSharedPtr
& rRenderModule
,
45 const ::canvas::ISurfaceProxyManagerSharedPtr
& rSurfaceProxy
,
46 bool bShowSpriteBounds
) :
47 mpSpriteCanvas( rRefDevice
),
50 ENSURE_OR_THROW( rRefDevice
.get(),
51 "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
56 ::canvas::tools::roundUp( rSpriteSize
.Width
),
57 ::canvas::tools::roundUp( rSpriteSize
.Height
)),
62 maCanvasHelper
.setDevice( *rRefDevice
.get() );
63 maCanvasHelper
.setTarget( mpSurface
);
65 maSpriteHelper
.init( rSpriteSize
,
71 // clear sprite to 100% transparent
72 maCanvasHelper
.clear();
75 void CanvasCustomSprite::disposeThis()
77 ::osl::MutexGuard
aGuard( m_aMutex
);
80 mpSpriteCanvas
.clear();
83 CanvasCustomSpriteBaseT::disposeThis();
86 OUString SAL_CALL
CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException
)
88 return OUString( "DXCanvas.CanvasCustomSprite" );
91 sal_Bool SAL_CALL
CanvasCustomSprite::supportsService( const OUString
& ServiceName
) throw( uno::RuntimeException
)
93 return cppu::supportsService( this, ServiceName
);
96 uno::Sequence
< OUString
> SAL_CALL
CanvasCustomSprite::getSupportedServiceNames() throw( uno::RuntimeException
)
98 uno::Sequence
< OUString
> aRet(1);
99 aRet
[0] = "com.sun.star.rendering.CanvasCustomSprite";
104 void CanvasCustomSprite::redraw() const
106 ::osl::MutexGuard
aGuard( m_aMutex
);
108 maSpriteHelper
.redraw( mbSurfaceDirty
);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */