LibreOffice Module canvas (master)  1
spritecanvashelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_CANVAS_SOURCE_VCL_SPRITECANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_SPRITECANVASHELPER_HXX
22 
23 #include <com/sun/star/rendering/XAnimatedSprite.hpp>
24 #include <com/sun/star/rendering/XAnimation.hpp>
25 #include <com/sun/star/rendering/XCustomSprite.hpp>
26 
27 #include <vcl/vclptr.hxx>
28 #include <vcl/virdev.hxx>
29 
30 #include <spriteredrawmanager.hxx>
31 #include <canvas/elapsedtime.hxx>
32 #include "canvashelper.hxx"
33 
34 
35 namespace vclcanvas
36 {
37  class SpriteCanvas;
38 
40  {
41  public:
44 
45  void init( const OutDevProviderSharedPtr& rOutDev,
46  SpriteCanvas& rOwningSpriteCanvas,
47  ::canvas::SpriteRedrawManager& rManager,
48  bool bProtect,
49  bool bHaveAlpha );
50 
52  void disposing();
53 
54  // XSpriteCanvas
55  css::uno::Reference<
56  css::rendering::XAnimatedSprite > createSpriteFromAnimation(
57  const css::uno::Reference< css::rendering::XAnimation >& animation );
58 
59  css::uno::Reference<
60  css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
61  const css::uno::Sequence<
62  css::uno::Reference<
63  css::rendering::XBitmap > >& animationBitmaps,
64  sal_Int8 interpolationMode );
65 
66  css::uno::Reference<
67  css::rendering::XCustomSprite > createCustomSprite(
68  const css::geometry::RealSize2D& spriteSize );
69 
70  css::uno::Reference<
71  css::rendering::XSprite > createClonedSprite(
72  const css::uno::Reference< css::rendering::XSprite >& original );
73 
84  bool updateScreen( bool bUpdateAll,
85  bool& io_bSurfaceDirty );
86 
87  // SpriteRedrawManager functor calls
88 
89 
92  void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
93 
110  void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
111  const ::basegfx::B2DRange& rMoveEnd,
112  const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
113 
114  void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
115  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
116 
117  void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
118  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
119 
120  css::uno::Any isUnsafeScrolling() const
121  {
122  return css::uno::Any(mbIsUnsafeScrolling);
123  }
124  void enableUnsafeScrolling( const css::uno::Any& rAny )
125  {
126  mbIsUnsafeScrolling = rAny.get<bool>();
127  }
128 
129  css::uno::Any isSpriteBounds() const
130  {
131  return css::uno::Any(mbShowSpriteBounds);
132  }
133  void enableSpriteBounds( const css::uno::Any& rAny )
134  {
135  mbShowSpriteBounds = rAny.get<bool>();
136  }
137 
138  private:
139  void renderFrameCounter( OutputDevice& rOutDev );
140  void renderSpriteCount( OutputDevice& rOutDev );
141  void renderMemUsage( OutputDevice& rOutDev );
142 
145 
148 
155 
158 
161 
164 
167  };
168 }
169 
170 #endif // INCLUDED_CANVAS_SOURCE_VCL_SPRITECANVASHELPER_HXX
171 
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
signed char sal_Int8
Calculate elapsed time.
Definition: elapsedtime.hxx:36
css::uno::Any isSpriteBounds() const
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
bool updateScreen(bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
bool mbIsUnsafeScrolling
When true, canvas uses the scroll optimization (direct scrolls in front buffer)
Helper class for basic canvas functionality.
css::uno::Any isUnsafeScrolling() const
This class manages smooth SpriteCanvas updates.
bool mbShowSpriteBounds
When true, canvas creates all new sprites with red lines in the corners.
Product of this component's factory.
bool mbShowFrameInfo
When true, canvas displays debug info on each frame.
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
VclPtr< VirtualDevice > maVDev
Background compositing surface.
void disposing()
Dispose all internal references.
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
void enableSpriteBounds(const css::uno::Any &rAny)
void init(const OutDevProviderSharedPtr &rOutDev, SpriteCanvas &rOwningSpriteCanvas,::canvas::SpriteRedrawManager &rManager, bool bProtect, bool bHaveAlpha)
void enableUnsafeScrolling(const css::uno::Any &rAny)
::canvas::tools::ElapsedTime maLastUpdate
For the frame counter timings.
SpriteCanvas * mpOwningSpriteCanvas
Set from the init method. used to generate sprites.
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
void renderFrameCounter(OutputDevice &rOutDev)
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void renderMemUsage(OutputDevice &rOutDev)
void renderSpriteCount(OutputDevice &rOutDev)