cid#1607171 Data race condition
[LibreOffice.git] / canvas / source / opengl / ogl_canvascustomsprite.hxx
blob3cd43cf4f17eedf3c8e2c62e19f5b053f0ae4d87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <cppuhelper/compbase.hxx>
14 #include <com/sun/star/rendering/XCustomSprite.hpp>
15 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
17 #include <basegfx/point/b2dpoint.hxx>
19 #include <base/basemutexhelper.hxx>
21 #include "ogl_spritecanvas.hxx"
22 #include "ogl_canvashelper.hxx"
25 namespace oglcanvas
27 typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
28 css::rendering::XCanvas > CanvasCustomSpriteBase_Base;
29 typedef ::canvas::CanvasBase<
30 ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
31 CanvasHelper,
32 ::osl::MutexGuard,
33 ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
35 /* Definition of CanvasCustomSprite class */
37 class CanvasCustomSprite : public CanvasCustomSpriteBaseT
39 public:
40 /** Create a custom sprite
42 @param rSpriteSize
43 Size of the sprite in pixel
45 @param rRefDevice
46 Associated output device
48 @param rSpriteCanvas
49 Target canvas
51 @param rDevice
52 Target DX device
54 CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
55 const SpriteCanvasRef& rRefDevice,
56 SpriteDeviceHelper& rDeviceHelper );
58 virtual void disposeThis() override;
60 // XSprite
61 virtual void SAL_CALL setAlpha( double alpha ) override;
62 virtual void SAL_CALL move( const css::geometry::RealPoint2D& aNewPos, const css::rendering::ViewState& viewState, const css::rendering::RenderState& renderState ) override;
63 virtual void SAL_CALL transform( const css::geometry::AffineMatrix2D& aTransformation ) override;
64 virtual void SAL_CALL clip( const css::uno::Reference< css::rendering::XPolyPolygon2D >& aClip ) override;
65 virtual void SAL_CALL setPriority( double nPriority ) override;
66 virtual void SAL_CALL show() override;
67 virtual void SAL_CALL hide() override;
69 // XCustomSprite
70 virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL getContentCanvas() override;
72 double getPriority() const { return mfPriority; }
74 /// Render sprite content at sprite position
75 bool renderSprite() const;
77 private:
78 /** MUST hold here, too, since CanvasHelper only contains a
79 raw pointer (without refcounting)
81 SpriteCanvasRef mpSpriteCanvas;
82 const css::geometry::RealSize2D maSize;
84 css::uno::Reference< css::rendering::XPolyPolygon2D > mxClip;
85 css::geometry::AffineMatrix2D maTransformation;
86 ::basegfx::B2DPoint maPosition;
87 double mfAlpha;
88 double mfPriority;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */