1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dx_spritehelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DXCANVAS_SPRITEHELPER_HXX
32 #define _DXCANVAS_SPRITEHELPER_HXX
34 #include <com/sun/star/rendering/XCustomSprite.hpp>
36 #include <canvas/base/canvascustomspritehelper.hxx>
38 #include <basegfx/point/b2dpoint.hxx>
39 #include <basegfx/vector/b2isize.hxx>
40 #include <basegfx/matrix/b2dhommatrix.hxx>
42 #include "dx_spritecanvas.hxx"
43 #include "dx_surfacebitmap.hxx"
47 /* Definition of SpriteHelper class */
49 /** Helper class for canvas sprites.
51 This class implements all sprite-related functionality, like
52 that available on the XSprite interface.
54 class SpriteHelper
: public ::canvas::CanvasCustomSpriteHelper
57 /** Create sprite helper
61 /** Late-init the sprite helper
67 Sprite canvas this sprite is part of. Object stores
68 ref-counted reference to it, thus, don't forget to pass on
75 The surface of the sprite (not the DX texture, but the
76 persistent target of content rendering)
78 @param bShowSpriteBounds
79 When true, little debug bound rects for sprites are shown
81 void init( const ::com::sun::star::geometry::RealSize2D
& rSpriteSize
,
82 const SpriteCanvasRef
& rSpriteCanvas
,
83 const IDXRenderModuleSharedPtr
& rRenderModule
,
84 const DXSurfaceBitmapSharedPtr rBitmap
,
85 bool bShowSpriteBounds
);
89 /** Repaint sprite content via hardware to associated sprite
92 @param io_bSurfaceDirty
93 Input/output parameter, whether the sprite content is
94 dirty or not. If texture was updated, set to false
97 void redraw( bool& io_bSurfaceDirty
) const;
100 virtual ::basegfx::B2DPolyPolygon
polyPolygonFromXPolyPolygon2D(
101 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XPolyPolygon2D
>& xPoly
) const;
103 /// Returns true, if the sprite _really_ needs redraw
104 bool needRedraw() const;
106 SpriteCanvasRef mpSpriteCanvas
;
108 DXSurfaceBitmapSharedPtr mpBitmap
;
109 mutable bool mbTextureDirty
; // when true, texture needs update
110 bool mbShowSpriteBounds
; // when true, debug bound rect for sprites is shown
114 #endif /* _DXCANVAS_SPRITEHELPER_HXX */