1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _NULLCANVAS_SPRITECANVASHELPER_HXX_
25 #define _NULLCANVAS_SPRITECANVASHELPER_HXX_
26 
27 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
28 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
29 
30 #include <canvas/spriteredrawmanager.hxx>
31 
32 #include "null_canvashelper.hxx"
33 
34 namespace basegfx
35 {
36     class B2IRange;
37 }
38 
39 namespace nullcanvas
40 {
41     class SpriteCanvas;
42 
43     class SpriteCanvasHelper : public CanvasHelper
44     {
45     public:
46         SpriteCanvasHelper();
47 
48         void init( ::canvas::SpriteRedrawManager& rManager,
49                    SpriteCanvas&                  rDevice,
50                    const ::basegfx::B2ISize&      rSize,
51                    bool                           bHasAlpha );
52 
53         /// Dispose all internal references
54         void disposing();
55 
56         // XSpriteCanvas
57         ::com::sun::star::uno::Reference<
58   			::com::sun::star::rendering::XAnimatedSprite > 		createSpriteFromAnimation(
59                 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation );
60 
61         ::com::sun::star::uno::Reference<
62   			::com::sun::star::rendering::XAnimatedSprite > 		createSpriteFromBitmaps(
63                 const ::com::sun::star::uno::Sequence<
64                 	  ::com::sun::star::uno::Reference<
65                 			::com::sun::star::rendering::XBitmap > >& animationBitmaps,
66                 sal_Int8                                              interpolationMode );
67 
68         ::com::sun::star::uno::Reference<
69   			::com::sun::star::rendering::XCustomSprite > 		createCustomSprite(
70                 const ::com::sun::star::geometry::RealSize2D& spriteSize );
71 
72         ::com::sun::star::uno::Reference<
73   			::com::sun::star::rendering::XSprite > 				createClonedSprite(
74                 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original );
75 
76         /** Actually perform the screen update
77 
78             @param rCurrArea
79             Current window area in absolute screen coordinates
80 
81         	@param bUpdateAll
82             sal_True, if everything must be updated, not only changed
83             sprites
84 
85             @param io_bSurfaceDirty
86             In/out parameter, whether backbuffer surface is dirty (if
87             yes, we're performing a full update, anyway)
88          */
89         sal_Bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
90                                sal_Bool                   bUpdateAll,
91                                bool&                      io_bSurfaceDirty );
92 
93 
94         // SpriteRedrawManager functor calls
95         // -------------------------------------------------
96 
97         /** Gets called for simple background repaints
98          */
99         void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
100 
101         /** Gets called when area can be handled by scrolling.
102 
103         	Called method must copy screen content from rMoveStart to
104         	rMoveEnd, and restore the background in the uncovered
105         	areas.
106 
107             @param rMoveStart
108             Source rect of the scroll
109 
110             @param rMoveEnd
111             Dest rect of the scroll
112 
113             @param rUpdateArea
114             All info necessary, should rMoveStart be partially or
115             fully outside the outdev
116          */
117         void scrollUpdate( const ::basegfx::B2DRange& 							rMoveStart,
118                            const ::basegfx::B2DRange& 							rMoveEnd,
119                            const ::canvas::SpriteRedrawManager::UpdateArea& 	rUpdateArea );
120 
121         void opaqueUpdate( const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
122 
123         void genericUpdate( const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
124 
125     private:
126         /// Set from the SpriteCanvas: instance coordinating sprite redraw
127     	::canvas::SpriteRedrawManager*	mpRedrawManager;
128     };
129 }
130 
131 #endif /* _NULLCANVAS_SPRITECANVASHELPER_HXX_ */
132 
133