update dev300-m58
[ooovba.git] / canvas / source / vcl / spritecanvashelper.hxx
bloba99f2040d1a67b5821adbd9aeedaed6b663e19d9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: spritecanvashelper.hxx,v $
10 * $Revision: 1.4 $
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 _VCLCANVAS_SPRITECANVASHELPER_HXX_
32 #define _VCLCANVAS_SPRITECANVASHELPER_HXX_
34 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
35 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
37 #include <vcl/virdev.hxx>
39 #include <canvas/spriteredrawmanager.hxx>
40 #include <canvas/elapsedtime.hxx>
41 #include <canvas/vclwrapper.hxx>
42 #include "canvashelper.hxx"
43 #include "impltools.hxx"
46 namespace vclcanvas
48 class RedrawManager;
49 class SpriteCanvas;
51 class SpriteCanvasHelper : public CanvasHelper
53 public:
54 SpriteCanvasHelper();
56 void init( const OutDevProviderSharedPtr& rOutDev,
57 SpriteCanvas& rOwningSpriteCanvas,
58 ::canvas::SpriteRedrawManager& rManager,
59 bool bProtect,
60 bool bHaveAlpha );
62 /// Dispose all internal references
63 void disposing();
65 // XSpriteCanvas
66 ::com::sun::star::uno::Reference<
67 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation(
68 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation );
70 ::com::sun::star::uno::Reference<
71 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps(
72 const ::com::sun::star::uno::Sequence<
73 ::com::sun::star::uno::Reference<
74 ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
75 sal_Int8 interpolationMode );
77 ::com::sun::star::uno::Reference<
78 ::com::sun::star::rendering::XCustomSprite > createCustomSprite(
79 const ::com::sun::star::geometry::RealSize2D& spriteSize );
81 ::com::sun::star::uno::Reference<
82 ::com::sun::star::rendering::XSprite > createClonedSprite(
83 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original );
85 /** Actually perform the screen update
87 @param bUpdateAll
88 sal_True, if everything must be updated, not only changed
89 sprites
91 @param io_bSurfaceDirty
92 In/out parameter, whether backbuffer surface is dirty (if
93 yes, we're performing a full update, anyway)
95 sal_Bool updateScreen( sal_Bool bUpdateAll,
96 bool& io_bSurfaceDirty );
98 // SpriteRedrawManager functor calls
99 // -------------------------------------------------
101 /** Gets called for simple background repaints
103 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
105 /** Gets called when area can be handled by scrolling.
107 Called method must copy screen content from rMoveStart to
108 rMoveEnd, and restore the background in the uncovered
109 areas.
111 @param rMoveStart
112 Source rect of the scroll
114 @param rMoveEnd
115 Dest rect of the scroll
117 @param rUpdateArea
118 All info necessary, should rMoveStart be partially or
119 fully outside the outdev
121 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
122 const ::basegfx::B2DRange& rMoveEnd,
123 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
125 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
126 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
128 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
129 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
131 ::com::sun::star::uno::Any isUnsafeScrolling() const
133 return ::com::sun::star::uno::makeAny(mbIsUnsafeScrolling);
135 void enableUnsafeScrolling( const ::com::sun::star::uno::Any& rAny )
137 mbIsUnsafeScrolling = rAny.get<bool>();
140 ::com::sun::star::uno::Any isSpriteBounds() const
142 return ::com::sun::star::uno::makeAny(mbShowSpriteBounds);
144 void enableSpriteBounds( const ::com::sun::star::uno::Any& rAny )
146 mbShowSpriteBounds = rAny.get<bool>();
149 private:
150 void renderFrameCounter( OutputDevice& rOutDev );
151 void renderSpriteCount( OutputDevice& rOutDev );
152 void renderMemUsage( OutputDevice& rOutDev );
154 /// Set from the SpriteCanvas: instance coordinating sprite redraw
155 ::canvas::SpriteRedrawManager* mpRedrawManager;
157 /// Set from the init method. used to generate sprites
158 SpriteCanvas* mpOwningSpriteCanvas;
160 /** Background compositing surface.
162 Typically, sprites will be composited in the background,
163 before pushing them to screen. This happens here.
165 ::canvas::vcltools::VCLObject< VirtualDevice > maVDev;
167 /// For the frame counter timings
168 ::canvas::tools::ElapsedTime maLastUpdate;
170 /// When true, canvas displays debug info on each frame
171 bool mbShowFrameInfo;
173 /// When true, canvas creates all new sprites with red lines in the corners
174 bool mbShowSpriteBounds;
176 /// When true, canvas uses the scroll optimization (direct scrolls in front buffer)
177 bool mbIsUnsafeScrolling;
181 #endif /* _VCLCANVAS_SPRITECANVASHELPER_HXX_ */