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_spritecanvashelper.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_SPRITECANVASHELPER_HXX_
32 #define _DXCANVAS_SPRITECANVASHELPER_HXX_
34 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
35 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
37 #include <canvas/spriteredrawmanager.hxx>
38 #include <canvas/rendering/isurfaceproxy.hxx>
39 #include <canvas/rendering/isurfaceproxymanager.hxx>
41 #include "dx_bitmapcanvashelper.hxx"
42 #include "dx_impltools.hxx"
43 #include "dx_rendermodule.hxx"
44 #include "dx_surfacebitmap.hxx"
46 #include <basegfx/range/b2irectangle.hxx>
52 class SpriteCanvasHelper
: public BitmapCanvasHelper
57 void init( SpriteCanvas
& rParent
,
58 ::canvas::SpriteRedrawManager
& rManager
,
59 const IDXRenderModuleSharedPtr
& rRenderModule
,
60 const ::canvas::ISurfaceProxyManagerSharedPtr
& rSurfaceProxy
,
61 const DXSurfaceBitmapSharedPtr
& rBackBuffer
,
62 const ::basegfx::B2ISize
& rOutputOffset
);
64 /// Dispose all internal references
68 ::com::sun::star::uno::Reference
<
69 ::com::sun::star::rendering::XAnimatedSprite
> createSpriteFromAnimation(
70 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XAnimation
>& animation
);
72 ::com::sun::star::uno::Reference
<
73 ::com::sun::star::rendering::XAnimatedSprite
> createSpriteFromBitmaps(
74 const ::com::sun::star::uno::Sequence
<
75 ::com::sun::star::uno::Reference
<
76 ::com::sun::star::rendering::XBitmap
> >& animationBitmaps
,
77 sal_Int8 interpolationMode
);
79 ::com::sun::star::uno::Reference
<
80 ::com::sun::star::rendering::XCustomSprite
> createCustomSprite(
81 const ::com::sun::star::geometry::RealSize2D
& spriteSize
);
83 ::com::sun::star::uno::Reference
<
84 ::com::sun::star::rendering::XSprite
> createClonedSprite(
85 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XSprite
>& original
);
87 /** Actually perform the screen update
90 Current window area in absolute screen coordinates
93 sal_True, if everything must be updated, not only changed
96 @param io_bSurfaceDirty
97 In/out parameter, whether backbuffer surface is dirty (if
98 yes, we're performing a full update, anyway)
100 sal_Bool
updateScreen( const ::basegfx::B2IRectangle
& rCurrArea
,
102 bool& io_bSurfaceDirty
);
105 // SpriteRedrawManager functor calls
106 // -------------------------------------------------
108 /** Gets called for simple background repaints
110 void backgroundPaint( const ::basegfx::B2DRange
& rUpdateRect
);
112 /** Gets called when area can be handled by scrolling.
114 Called method must copy screen content from rMoveStart to
115 rMoveEnd, and restore the background in the uncovered
119 Source rect of the scroll
122 Dest rect of the scroll
125 All info necessary, should rMoveStart be partially or
126 fully outside the outdev
128 void scrollUpdate( const ::basegfx::B2DRange
& rMoveStart
,
129 const ::basegfx::B2DRange
& rMoveEnd
,
130 const ::canvas::SpriteRedrawManager::UpdateArea
& rUpdateArea
);
132 void opaqueUpdate( const ::basegfx::B2DRange
& rTotalArea
,
133 const ::std::vector
< ::canvas::Sprite::Reference
>& rSortedUpdateSprites
);
135 void genericUpdate( const ::basegfx::B2DRange
& rTotalArea
,
136 const ::std::vector
< ::canvas::Sprite::Reference
>& rSortedUpdateSprites
);
139 /// For generating sprites
140 SpriteCanvas
* mpSpriteSurface
;
142 /// Set from the SpriteCanvas: instance coordinating sprite redraw
143 ::canvas::SpriteRedrawManager
* mpRedrawManager
;
145 /// DX device, handling all low-level rendering
146 IDXRenderModuleSharedPtr mpRenderModule
;
148 ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxy
;
150 /// Backbuffer, contains the static canvas render output
151 DXSurfaceBitmapSharedPtr mpBackBuffer
;
153 /// Completely temporary rect storage (used by sprite repaint)
154 mutable ::basegfx::B2IRange maUpdateRect
;
156 /// Completely temporary rect storage (used by sprite repaint)
157 mutable ::basegfx::B2IRange maScrapRect
;
159 /// When true, show small bound rects around each sprite
160 bool mbShowSpriteBounds
;
164 #endif /* _DXCANVAS_SPRITECANVASHELPER_HXX_ */