Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _NULLCANVAS_SPRITEHELPER_HXX
21 : #define _NULLCANVAS_SPRITEHELPER_HXX
22 :
23 : #include <com/sun/star/rendering/XCustomSprite.hpp>
24 :
25 : #include <canvas/base/canvascustomspritehelper.hxx>
26 :
27 : #include <basegfx/point/b2dpoint.hxx>
28 : #include <basegfx/vector/b2isize.hxx>
29 : #include <basegfx/matrix/b2dhommatrix.hxx>
30 :
31 : #include "null_spritecanvas.hxx"
32 :
33 :
34 : namespace nullcanvas
35 : {
36 : /* Definition of SpriteHelper class */
37 :
38 : /** Helper class for canvas sprites.
39 :
40 : This class implements all sprite-related functionality, like
41 : that available on the XSprite interface.
42 : */
43 0 : class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper
44 : {
45 : public:
46 : /** Create sprite helper
47 : */
48 : SpriteHelper();
49 :
50 : // make CanvasCustomSpriteHelper::init visible for name lookup
51 : using ::canvas::CanvasCustomSpriteHelper::init;
52 :
53 : /** Late-init the sprite helper
54 :
55 : @param rSpriteSize
56 : Size of the sprite
57 :
58 : @param rSpriteCanvas
59 : Sprite canvas this sprite is part of. Object stores
60 : ref-counted reference to it, thus, don't forget to pass on
61 : disposing()!
62 :
63 : @param rDevice
64 : DX device to use
65 :
66 : @param rSpriteSurface
67 : The surface of the sprite (not the DX texture, but the
68 : persistent target of content rendering)
69 :
70 : @param bShowSpriteBounds
71 : When true, little debug bound rects for sprites are shown
72 : */
73 : void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
74 : const SpriteCanvasRef& rSpriteCanvas );
75 :
76 : void disposing();
77 :
78 : /** Repaint sprite content via hardware to associated sprite
79 : canvas
80 :
81 : @param io_bSurfaceDirty
82 : Input/output parameter, whether the sprite content is
83 : dirty or not. If texture was updated, set to false
84 : */
85 : void redraw( bool& io_bSurfaceDirty ) const;
86 :
87 : private:
88 : virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
89 : ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const;
90 :
91 :
92 : SpriteCanvasRef mpSpriteCanvas;
93 : mutable bool mbTextureDirty; // when true, texture needs update
94 : };
95 : }
96 :
97 : #endif /* _NULLCANVAS_SPRITEHELPER_HXX */
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|