Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / cairo / cairo_spritecanvashelper.hxx
blob11b13510338de9294b6d56bdd9ad6878fea23611
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 #ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVASHELPER_HXX
23 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
24 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
26 #include <canvas/spriteredrawmanager.hxx>
28 #include <vcl/cairo.hxx>
29 #include "cairo_canvashelper.hxx"
31 namespace basegfx
33 class B2IRange;
36 namespace cairocanvas
38 class SpriteCanvas;
40 class SpriteCanvasHelper : public CanvasHelper
42 public:
43 SpriteCanvasHelper();
45 void init( ::canvas::SpriteRedrawManager& rManager,
46 SpriteCanvas& rOwningSpriteCanvas,
47 const ::basegfx::B2ISize& rSize );
49 /// Dispose all internal references
50 void disposing();
52 // XSpriteCanvas
53 ::com::sun::star::uno::Reference<
54 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation(
55 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation );
57 ::com::sun::star::uno::Reference<
58 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps(
59 const ::com::sun::star::uno::Sequence<
60 ::com::sun::star::uno::Reference<
61 ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
62 sal_Int8 interpolationMode );
64 ::com::sun::star::uno::Reference<
65 ::com::sun::star::rendering::XCustomSprite > createCustomSprite(
66 const ::com::sun::star::geometry::RealSize2D& spriteSize );
68 ::com::sun::star::uno::Reference<
69 ::com::sun::star::rendering::XSprite > createClonedSprite(
70 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original );
72 /** Actually perform the screen update
74 @param rCurrArea
75 Current window area in absolute screen coordinates
77 @param bUpdateAll
78 sal_True, if everything must be updated, not only changed
79 sprites
81 @param io_bSurfaceDirty
82 In/out parameter, whether backbuffer surface is dirty (if
83 yes, we're performing a full update, anyway)
85 bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
86 bool bUpdateAll,
87 bool& io_bSurfaceDirty );
90 // SpriteRedrawManager functor calls
93 /** Gets called for simple background repaints
95 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
97 /** Gets called when area can be handled by scrolling.
99 Called method must copy screen content from rMoveStart to
100 rMoveEnd, and restore the background in the uncovered
101 areas.
103 @param rMoveStart
104 Source rect of the scroll
106 @param rMoveEnd
107 Dest rect of the scroll
109 @param rUpdateArea
110 All info necessary, should rMoveStart be partially or
111 fully outside the outdev
113 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
114 const ::basegfx::B2DRange& rMoveEnd,
115 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
117 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
118 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
120 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
121 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
123 private:
124 ::cairo::SurfaceSharedPtr getCompositingSurface( const ::basegfx::B2ISize& rNeededSize );
125 ::cairo::SurfaceSharedPtr getTemporarySurface();
126 ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rNeededSize ) const;
128 /// Set from the SpriteCanvas: instance coordinating sprite redraw
129 ::canvas::SpriteRedrawManager* mpRedrawManager;
131 /// Set from the init method. used to generate sprites
132 SpriteCanvas* mpOwningSpriteCanvas;
134 /// a surface used to composite the frontbuffer image
135 ::cairo::SurfaceSharedPtr mpCompositingSurface;
136 ::basegfx::B2ISize maCompositingSurfaceSize;
137 bool mbCompositingSurfaceDirty;
138 /// a temporary surface that is guaranteed to be the same size
139 //as the compositing surface
140 ::cairo::SurfaceSharedPtr mpTemporarySurface;
144 #endif // INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVASHELPER_HXX
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */