bump product version to 7.6.3.2-android
[LibreOffice.git] / canvas / source / vcl / spritecanvashelper.hxx
blobaf3f5526a8da5ad940dd9d6fc60cbf7da1cf50ed
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <com/sun/star/rendering/XAnimatedSprite.hpp>
23 #include <com/sun/star/rendering/XAnimation.hpp>
24 #include <com/sun/star/rendering/XCustomSprite.hpp>
26 #include <vcl/vclptr.hxx>
27 #include <vcl/virdev.hxx>
29 #include <spriteredrawmanager.hxx>
30 #include <canvas/elapsedtime.hxx>
31 #include "canvashelper.hxx"
34 namespace vclcanvas
36 class SpriteCanvas;
38 class SpriteCanvasHelper : public CanvasHelper
40 public:
41 SpriteCanvasHelper();
42 ~SpriteCanvasHelper();
44 void init( const OutDevProviderSharedPtr& rOutDev,
45 SpriteCanvas& rOwningSpriteCanvas,
46 ::canvas::SpriteRedrawManager& rManager,
47 bool bProtect,
48 bool bHaveAlpha );
50 /// Dispose all internal references
51 void disposing();
53 // XSpriteCanvas
54 css::uno::Reference<
55 css::rendering::XAnimatedSprite > createSpriteFromAnimation(
56 const css::uno::Reference< css::rendering::XAnimation >& animation );
58 css::uno::Reference<
59 css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
60 const css::uno::Sequence<
61 css::uno::Reference<
62 css::rendering::XBitmap > >& animationBitmaps,
63 sal_Int8 interpolationMode );
65 css::uno::Reference<
66 css::rendering::XCustomSprite > createCustomSprite(
67 const css::geometry::RealSize2D& spriteSize );
69 css::uno::Reference<
70 css::rendering::XSprite > createClonedSprite(
71 const css::uno::Reference< css::rendering::XSprite >& original );
73 /** Actually perform the screen update
75 @param bUpdateAll
76 sal_True, if everything must be updated, not only changed
77 sprites
79 @param io_bSurfaceDirty
80 In/out parameter, whether backbuffer surface is dirty (if
81 yes, we're performing a full update, anyway)
83 bool updateScreen( bool bUpdateAll,
84 bool& io_bSurfaceDirty );
86 // SpriteRedrawManager functor calls
89 /** Gets called for simple background repaints
91 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
93 /** Gets called when area can be handled by scrolling.
95 Called method must copy screen content from rMoveStart to
96 rMoveEnd, and restore the background in the uncovered
97 areas.
99 @param rMoveStart
100 Source rect of the scroll
102 @param rMoveEnd
103 Dest rect of the scroll
105 @param rUpdateArea
106 All info necessary, should rMoveStart be partially or
107 fully outside the outdev
109 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
110 const ::basegfx::B2DRange& rMoveEnd,
111 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
113 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
114 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
116 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
117 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
119 css::uno::Any isUnsafeScrolling() const
121 return css::uno::Any(mbIsUnsafeScrolling);
123 void enableUnsafeScrolling( const css::uno::Any& rAny )
125 mbIsUnsafeScrolling = rAny.get<bool>();
128 css::uno::Any isSpriteBounds() const
130 return css::uno::Any(mbShowSpriteBounds);
132 void enableSpriteBounds( const css::uno::Any& rAny )
134 mbShowSpriteBounds = rAny.get<bool>();
137 private:
138 void renderFrameCounter( OutputDevice& rOutDev );
139 void renderSpriteCount( OutputDevice& rOutDev );
140 void renderMemUsage( OutputDevice& rOutDev );
142 /// Set from the SpriteCanvas: instance coordinating sprite redraw
143 ::canvas::SpriteRedrawManager* mpRedrawManager;
145 /// Set from the init method. used to generate sprites
146 SpriteCanvas* mpOwningSpriteCanvas;
148 /** Background compositing surface.
150 Typically, sprites will be composited in the background,
151 before pushing them to screen. This happens here.
153 VclPtr< VirtualDevice > maVDev;
155 /// For the frame counter timings
156 ::canvas::tools::ElapsedTime maLastUpdate;
158 /// When true, canvas displays debug info on each frame
159 bool mbShowFrameInfo;
161 /// When true, canvas creates all new sprites with red lines in the corners
162 bool mbShowSpriteBounds;
164 /// When true, canvas uses the scroll optimization (direct scrolls in front buffer)
165 bool mbIsUnsafeScrolling;
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */