Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / directx / dx_spritecanvashelper.hxx
blobf6fb74f88cf1236ee7b099871fd457f0c0ac0a33
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_DIRECTX_DX_SPRITECANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVASHELPER_HXX
23 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
24 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
26 #include <canvas/spriteredrawmanager.hxx>
27 #include <canvas/rendering/isurfaceproxy.hxx>
28 #include <canvas/rendering/isurfaceproxymanager.hxx>
30 #include "dx_bitmapcanvashelper.hxx"
31 #include "dx_impltools.hxx"
32 #include "dx_rendermodule.hxx"
33 #include "dx_surfacebitmap.hxx"
35 #include <basegfx/range/b2irectangle.hxx>
37 namespace dxcanvas
39 class SpriteCanvas;
41 class SpriteCanvasHelper : public BitmapCanvasHelper
43 public:
44 SpriteCanvasHelper();
46 void init( SpriteCanvas& rParent,
47 ::canvas::SpriteRedrawManager& rManager,
48 const IDXRenderModuleSharedPtr& rRenderModule,
49 const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy,
50 const DXSurfaceBitmapSharedPtr& rBackBuffer,
51 const ::basegfx::B2ISize& rOutputOffset );
53 /// Dispose all internal references
54 void disposing();
56 // XSpriteCanvas
57 ::com::sun::star::uno::Reference<
58 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation(
59 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation );
61 ::com::sun::star::uno::Reference<
62 ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps(
63 const ::com::sun::star::uno::Sequence<
64 ::com::sun::star::uno::Reference<
65 ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
66 sal_Int8 interpolationMode );
68 ::com::sun::star::uno::Reference<
69 ::com::sun::star::rendering::XCustomSprite > createCustomSprite(
70 const ::com::sun::star::geometry::RealSize2D& spriteSize );
72 ::com::sun::star::uno::Reference<
73 ::com::sun::star::rendering::XSprite > createClonedSprite(
74 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original );
76 /** Actually perform the screen update
78 @param rCurrArea
79 Current window area in absolute screen coordinates
81 @param bUpdateAll
82 sal_True, if everything must be updated, not only changed
83 sprites
85 @param io_bSurfaceDirty
86 In/out parameter, whether backbuffer surface is dirty (if
87 yes, we're performing a full update, anyway)
89 bool updateScreen( const ::basegfx::B2IRectangle& rCurrArea,
90 bool bUpdateAll,
91 bool& io_bSurfaceDirty );
94 // SpriteRedrawManager functor calls
97 /** Gets called for simple background repaints
99 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
101 /** Gets called when area can be handled by scrolling.
103 Called method must copy screen content from rMoveStart to
104 rMoveEnd, and restore the background in the uncovered
105 areas.
107 @param rMoveStart
108 Source rect of the scroll
110 @param rMoveEnd
111 Dest rect of the scroll
113 @param rUpdateArea
114 All info necessary, should rMoveStart be partially or
115 fully outside the outdev
117 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
118 const ::basegfx::B2DRange& rMoveEnd,
119 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
121 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
122 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
124 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
125 const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
127 private:
128 /// For generating sprites
129 SpriteCanvas* mpSpriteSurface;
131 /// Set from the SpriteCanvas: instance coordinating sprite redraw
132 ::canvas::SpriteRedrawManager* mpRedrawManager;
134 /// DX device, handling all low-level rendering
135 IDXRenderModuleSharedPtr mpRenderModule;
137 ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxy;
139 /// Backbuffer, contains the static canvas render output
140 DXSurfaceBitmapSharedPtr mpBackBuffer;
142 /// Completely temporary rect storage (used by sprite repaint)
143 mutable ::basegfx::B2IRange maUpdateRect;
145 /// Completely temporary rect storage (used by sprite repaint)
146 mutable ::basegfx::B2IRange maScrapRect;
148 /// When true, show small bound rects around each sprite
149 bool mbShowSpriteBounds;
153 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVASHELPER_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */