tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / canvas / source / cairo / cairo_spritecanvashelper.hxx
blob2b11f1bcf0ac35518da93edb46abc16c53d60849
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 #pragma once
22 #include <com/sun/star/rendering/XAnimatedSprite.hpp>
23 #include <com/sun/star/rendering/XAnimation.hpp>
24 #include <com/sun/star/rendering/XCustomSprite.hpp>
26 #include <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 css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(
54 const css::uno::Reference< css::rendering::XAnimation >& animation );
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 );
62 css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(
63 const css::geometry::RealSize2D& spriteSize );
65 css::uno::Reference< css::rendering::XSprite > createClonedSprite(
66 const css::uno::Reference< css::rendering::XSprite >& original );
68 /** Actually perform the screen update
70 @param rCurrArea
71 Current window area in absolute screen coordinates
73 @param bUpdateAll
74 sal_True, if everything must be updated, not only changed
75 sprites
77 @param io_bSurfaceDirty
78 In/out parameter, whether backbuffer surface is dirty (if
79 yes, we're performing a full update, anyway)
81 bool updateScreen( const ::basegfx::B2IRange& rCurrArea,
82 bool bUpdateAll,
83 bool& io_bSurfaceDirty );
86 // SpriteRedrawManager functor calls
89 /** Gets called for simple background repaints
91 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
93 /** Gets called when area can be handled by scrolling.
95 Called method must copy screen content from rMoveStart to
96 rMoveEnd, and restore the background in the uncovered
97 areas.
99 @param rMoveStart
100 Source rect of the scroll
102 @param rMoveEnd
103 Dest rect of the scroll
105 @param rUpdateArea
106 All info necessary, should rMoveStart be partially or
107 fully outside the outdev
109 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
110 const ::basegfx::B2DRange& rMoveEnd,
111 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
113 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
114 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
116 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
117 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
119 private:
120 ::cairo::SurfaceSharedPtr const & getCompositingSurface( const ::basegfx::B2ISize& rNeededSize );
121 ::cairo::SurfaceSharedPtr const & getTemporarySurface();
122 ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rNeededSize ) const;
124 /// Set from the SpriteCanvas: instance coordinating sprite redraw
125 ::canvas::SpriteRedrawManager* mpRedrawManager;
127 /// Set from the init method. used to generate sprites
128 SpriteCanvas* mpOwningSpriteCanvas;
130 /// a surface used to composite the frontbuffer image
131 ::cairo::SurfaceSharedPtr mpCompositingSurface;
132 ::basegfx::B2ISize maCompositingSurfaceSize;
133 bool mbCompositingSurfaceDirty;
134 /// a temporary surface that is guaranteed to be the same size
135 //as the compositing surface
136 ::cairo::SurfaceSharedPtr mpTemporarySurface;
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */