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: cairo_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 _CAIROCANVAS_SPRITECANVASHELPER_HXX_
32 #define _CAIROCANVAS_SPRITECANVASHELPER_HXX_
34 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
35 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
37 #include <canvas/spriteredrawmanager.hxx>
39 #include "cairo_cairo.hxx"
40 #include "cairo_canvashelper.hxx"
51 class SpriteCanvasHelper
: public CanvasHelper
56 void init( ::canvas::SpriteRedrawManager
& rManager
,
57 SpriteCanvas
& rOwningSpriteCanvas
,
58 const ::basegfx::B2ISize
& rSize
);
60 /// Dispose all internal references
64 ::com::sun::star::uno::Reference
<
65 ::com::sun::star::rendering::XAnimatedSprite
> createSpriteFromAnimation(
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XAnimation
>& animation
);
68 ::com::sun::star::uno::Reference
<
69 ::com::sun::star::rendering::XAnimatedSprite
> createSpriteFromBitmaps(
70 const ::com::sun::star::uno::Sequence
<
71 ::com::sun::star::uno::Reference
<
72 ::com::sun::star::rendering::XBitmap
> >& animationBitmaps
,
73 sal_Int8 interpolationMode
);
75 ::com::sun::star::uno::Reference
<
76 ::com::sun::star::rendering::XCustomSprite
> createCustomSprite(
77 const ::com::sun::star::geometry::RealSize2D
& spriteSize
);
79 ::com::sun::star::uno::Reference
<
80 ::com::sun::star::rendering::XSprite
> createClonedSprite(
81 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XSprite
>& original
);
83 /** Actually perform the screen update
86 Current window area in absolute screen coordinates
89 sal_True, if everything must be updated, not only changed
92 @param io_bSurfaceDirty
93 In/out parameter, whether backbuffer surface is dirty (if
94 yes, we're performing a full update, anyway)
96 sal_Bool
updateScreen( const ::basegfx::B2IRange
& rCurrArea
,
98 bool& io_bSurfaceDirty
);
101 // SpriteRedrawManager functor calls
102 // -------------------------------------------------
104 /** Gets called for simple background repaints
106 void backgroundPaint( const ::basegfx::B2DRange
& rUpdateRect
);
108 /** Gets called when area can be handled by scrolling.
110 Called method must copy screen content from rMoveStart to
111 rMoveEnd, and restore the background in the uncovered
115 Source rect of the scroll
118 Dest rect of the scroll
121 All info necessary, should rMoveStart be partially or
122 fully outside the outdev
124 void scrollUpdate( const ::basegfx::B2DRange
& rMoveStart
,
125 const ::basegfx::B2DRange
& rMoveEnd
,
126 const ::canvas::SpriteRedrawManager::UpdateArea
& rUpdateArea
);
128 void opaqueUpdate( const ::basegfx::B2DRange
& rTotalArea
,
129 const ::std::vector
< ::canvas::Sprite::Reference
>& rSortedUpdateSprites
);
131 void genericUpdate( const ::basegfx::B2DRange
& rTotalArea
,
132 const ::std::vector
< ::canvas::Sprite::Reference
>& rSortedUpdateSprites
);
135 ::cairo::SurfaceSharedPtr
getCompositingSurface( const ::basegfx::B2ISize
& rNeededSize
);
137 /// Set from the SpriteCanvas: instance coordinating sprite redraw
138 ::canvas::SpriteRedrawManager
* mpRedrawManager
;
140 /// Set from the init method. used to generate sprites
141 SpriteCanvas
* mpOwningSpriteCanvas
;
143 /// a temporary surface used to composite the frontbuffer image
144 ::cairo::SurfaceSharedPtr mpCompositingSurface
;
145 ::basegfx::B2ISize maCompositingSurfaceSize
;
149 #endif /* _CAIROCANVAS_SPRITECANVASHELPER_HXX_ */