LibreOffice Module canvas (master)  1
cairo_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_CAIRO_CAIRO_SPRITECANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_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 <spriteredrawmanager.hxx>
28 
29 #include <vcl/cairo.hxx>
30 #include "cairo_canvashelper.hxx"
31 
32 namespace basegfx
33 {
34  class B2IRange;
35 }
36 
37 namespace cairocanvas
38 {
39  class SpriteCanvas;
40 
42  {
43  public:
45 
46  void init( ::canvas::SpriteRedrawManager& rManager,
47  SpriteCanvas& rOwningSpriteCanvas,
48  const ::basegfx::B2ISize& rSize );
49 
51  void disposing();
52 
53  // XSpriteCanvas
54  css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(
55  const css::uno::Reference< css::rendering::XAnimation >& animation );
56 
57  css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
58  const css::uno::Sequence<
59  css::uno::Reference<
60  css::rendering::XBitmap > >& animationBitmaps,
61  sal_Int8 interpolationMode );
62 
63  css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(
64  const css::geometry::RealSize2D& spriteSize );
65 
66  css::uno::Reference< css::rendering::XSprite > createClonedSprite(
67  const css::uno::Reference< css::rendering::XSprite >& original );
68 
82  bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
83  bool bUpdateAll,
84  bool& io_bSurfaceDirty );
85 
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  private:
121  ::cairo::SurfaceSharedPtr const & getCompositingSurface( const ::basegfx::B2ISize& rNeededSize );
123  ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rNeededSize ) const;
124 
127 
130 
136  //as the compositing surface
138  };
139 }
140 
141 #endif // INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVASHELPER_HXX
142 
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
signed char sal_Int8
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
::cairo::SurfaceSharedPtr mpCompositingSurface
a surface used to composite the frontbuffer image
This class manages smooth SpriteCanvas updates.
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
bool updateScreen(const ::basegfx::B2IRange &rCurrArea, bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
std::shared_ptr< Surface > SurfaceSharedPtr
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
::cairo::SurfaceSharedPtr const & getCompositingSurface(const ::basegfx::B2ISize &rNeededSize)
void init(::canvas::SpriteRedrawManager &rManager, SpriteCanvas &rOwningSpriteCanvas, const ::basegfx::B2ISize &rSize)
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
Product of this component's factory.
::cairo::SurfaceSharedPtr createSurface(const ::basegfx::B2ISize &rNeededSize) const
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
SpriteCanvas * mpOwningSpriteCanvas
Set from the init method. used to generate sprites.
::cairo::SurfaceSharedPtr mpTemporarySurface
a temporary surface that is guaranteed to be the same size
::cairo::SurfaceSharedPtr const & getTemporarySurface()
void disposing()
Dispose all internal references.