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#pragma once
21
22#include <com/sun/star/rendering/XAnimatedSprite.hpp>
23#include <com/sun/star/rendering/XAnimation.hpp>
24#include <com/sun/star/rendering/XCustomSprite.hpp>
25
26#include <vcl/vclptr.hxx>
27#include <vcl/virdev.hxx>
28
31#include "canvashelper.hxx"
32
33
34namespace vclcanvas
35{
36 class SpriteCanvas;
37
39 {
40 public:
43
44 void init( const OutDevProviderSharedPtr& rOutDev,
45 SpriteCanvas& rOwningSpriteCanvas,
47 bool bProtect,
48 bool bHaveAlpha );
49
51 void disposing();
52
53 // XSpriteCanvas
54 css::uno::Reference<
55 css::rendering::XAnimatedSprite > createSpriteFromAnimation(
56 const css::uno::Reference< css::rendering::XAnimation >& animation );
57
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 );
64
65 css::uno::Reference<
66 css::rendering::XCustomSprite > createCustomSprite(
67 const css::geometry::RealSize2D& spriteSize );
68
69 css::uno::Reference<
70 css::rendering::XSprite > createClonedSprite(
71 const css::uno::Reference< css::rendering::XSprite >& original );
72
83 bool updateScreen( bool bUpdateAll,
84 bool& io_bSurfaceDirty );
85
86 // SpriteRedrawManager functor calls
87
88
91 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
92
109 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
110 const ::basegfx::B2DRange& rMoveEnd,
111 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
112
113 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
114 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
115
116 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
117 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
118
119 css::uno::Any isUnsafeScrolling() const
120 {
121 return css::uno::Any(mbIsUnsafeScrolling);
122 }
123 void enableUnsafeScrolling( const css::uno::Any& rAny )
124 {
125 mbIsUnsafeScrolling = rAny.get<bool>();
126 }
127
128 css::uno::Any isSpriteBounds() const
129 {
130 return css::uno::Any(mbShowSpriteBounds);
131 }
132 void enableSpriteBounds( const css::uno::Any& rAny )
133 {
134 mbShowSpriteBounds = rAny.get<bool>();
135 }
136
137 private:
138 void renderFrameCounter( OutputDevice& rOutDev );
139 void renderSpriteCount( OutputDevice& rOutDev );
140 void renderMemUsage( OutputDevice& rOutDev );
141
144
147
154
157
160
163
166 };
167}
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class manages smooth SpriteCanvas updates.
Calculate elapsed time.
Definition: elapsedtime.hxx:35
Helper class for basic canvas functionality.
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
void renderFrameCounter(OutputDevice &rOutDev)
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
bool mbIsUnsafeScrolling
When true, canvas uses the scroll optimization (direct scrolls in front buffer)
void renderMemUsage(OutputDevice &rOutDev)
bool mbShowFrameInfo
When true, canvas displays debug info on each frame.
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
css::uno::Any isSpriteBounds() const
::canvas::tools::ElapsedTime maLastUpdate
For the frame counter timings.
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
void renderSpriteCount(OutputDevice &rOutDev)
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
bool mbShowSpriteBounds
When true, canvas creates all new sprites with red lines in the corners.
void enableSpriteBounds(const css::uno::Any &rAny)
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void init(const OutDevProviderSharedPtr &rOutDev, SpriteCanvas &rOwningSpriteCanvas, ::canvas::SpriteRedrawManager &rManager, bool bProtect, bool bHaveAlpha)
void disposing()
Dispose all internal references.
css::uno::Any isUnsafeScrolling() const
SpriteCanvas * mpOwningSpriteCanvas
Set from the init method. used to generate sprites.
bool updateScreen(bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
VclPtr< VirtualDevice > maVDev
Background compositing surface.
void enableUnsafeScrolling(const css::uno::Any &rAny)
Product of this component's factory.
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
signed char sal_Int8