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 #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 <spriteredrawmanager.hxx>
27 
28 #include <vcl/cairo.hxx>
29 #include "cairo_canvashelper.hxx"
30 
31 namespace basegfx
32 {
33  class B2IRange;
34 }
35 
36 namespace cairocanvas
37 {
38  class SpriteCanvas;
39 
41  {
42  public:
44 
45  void init( ::canvas::SpriteRedrawManager& rManager,
46  SpriteCanvas& rOwningSpriteCanvas,
47  const ::basegfx::B2ISize& rSize );
48 
50  void disposing();
51 
52  // XSpriteCanvas
53  css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(
54  const css::uno::Reference< css::rendering::XAnimation >& animation );
55 
56  css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
57  const css::uno::Sequence<
58  css::uno::Reference<
59  css::rendering::XBitmap > >& animationBitmaps,
60  sal_Int8 interpolationMode );
61 
62  css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(
63  const css::geometry::RealSize2D& spriteSize );
64 
65  css::uno::Reference< css::rendering::XSprite > createClonedSprite(
66  const css::uno::Reference< css::rendering::XSprite >& original );
67 
81  bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
82  bool bUpdateAll,
83  bool& io_bSurfaceDirty );
84 
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  private:
120  ::cairo::SurfaceSharedPtr const & getCompositingSurface( const ::basegfx::B2ISize& rNeededSize );
122  ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rNeededSize ) const;
123 
126 
129 
135  //as the compositing surface
137  };
138 }
139 
140 /* 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.