Branch data Line data Source code
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 _CAIROCANVAS_SPRITECANVASHELPER_HXX_
21 : : #define _CAIROCANVAS_SPRITECANVASHELPER_HXX_
22 : :
23 : : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
24 : : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
25 : :
26 : : #include <canvas/spriteredrawmanager.hxx>
27 : :
28 : : #include "cairo_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 : :
40 : 0 : class SpriteCanvasHelper : public CanvasHelper
41 : : {
42 : : public:
43 : : SpriteCanvasHelper();
44 : :
45 : : void init( ::canvas::SpriteRedrawManager& rManager,
46 : : SpriteCanvas& rOwningSpriteCanvas,
47 : : const ::basegfx::B2ISize& rSize );
48 : :
49 : : /// Dispose all internal references
50 : : void disposing();
51 : :
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 );
56 : :
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 );
63 : :
64 : : ::com::sun::star::uno::Reference<
65 : : ::com::sun::star::rendering::XCustomSprite > createCustomSprite(
66 : : const ::com::sun::star::geometry::RealSize2D& spriteSize );
67 : :
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 );
71 : :
72 : : /** Actually perform the screen update
73 : :
74 : : @param rCurrArea
75 : : Current window area in absolute screen coordinates
76 : :
77 : : @param bUpdateAll
78 : : sal_True, if everything must be updated, not only changed
79 : : sprites
80 : :
81 : : @param io_bSurfaceDirty
82 : : In/out parameter, whether backbuffer surface is dirty (if
83 : : yes, we're performing a full update, anyway)
84 : : */
85 : : sal_Bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
86 : : sal_Bool bUpdateAll,
87 : : bool& io_bSurfaceDirty );
88 : :
89 : :
90 : : // SpriteRedrawManager functor calls
91 : : // -------------------------------------------------
92 : :
93 : : /** Gets called for simple background repaints
94 : : */
95 : : void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
96 : :
97 : : /** Gets called when area can be handled by scrolling.
98 : :
99 : : Called method must copy screen content from rMoveStart to
100 : : rMoveEnd, and restore the background in the uncovered
101 : : areas.
102 : :
103 : : @param rMoveStart
104 : : Source rect of the scroll
105 : :
106 : : @param rMoveEnd
107 : : Dest rect of the scroll
108 : :
109 : : @param rUpdateArea
110 : : All info necessary, should rMoveStart be partially or
111 : : fully outside the outdev
112 : : */
113 : : void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
114 : : const ::basegfx::B2DRange& rMoveEnd,
115 : : const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
116 : :
117 : : void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
118 : : const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
119 : :
120 : : void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
121 : : const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
122 : :
123 : : private:
124 : : ::cairo::SurfaceSharedPtr getCompositingSurface( const ::basegfx::B2ISize& rNeededSize );
125 : : ::cairo::SurfaceSharedPtr getTemporarySurface();
126 : : ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rNeededSize ) const;
127 : :
128 : : /// Set from the SpriteCanvas: instance coordinating sprite redraw
129 : : ::canvas::SpriteRedrawManager* mpRedrawManager;
130 : :
131 : : /// Set from the init method. used to generate sprites
132 : : SpriteCanvas* mpOwningSpriteCanvas;
133 : :
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;
141 : : };
142 : : }
143 : :
144 : : #endif /* _CAIROCANVAS_SPRITECANVASHELPER_HXX_ */
145 : :
146 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|