LibreOffice Module canvas (master)  1
dx_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 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVASHELPER_HXX
22 
23 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
24 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
25 
29 
31 #include "dx_impltools.hxx"
32 #include "dx_rendermodule.hxx"
33 #include "dx_surfacebitmap.hxx"
34 
36 
37 namespace dxcanvas
38 {
39  class SpriteCanvas;
40 
42  {
43  public:
45 
46  void init( SpriteCanvas& rParent,
47  ::canvas::SpriteRedrawManager& rManager,
48  const IDXRenderModuleSharedPtr& rRenderModule,
49  const std::shared_ptr<canvas::ISurfaceProxyManager>& rSurfaceProxy,
50  const DXSurfaceBitmapSharedPtr& rBackBuffer,
51  const ::basegfx::B2ISize& rOutputOffset );
52 
54  void disposing();
55 
56  // XSpriteCanvas
57  css::uno::Reference<
58  css::rendering::XAnimatedSprite > createSpriteFromAnimation(
59  const css::uno::Reference< css::rendering::XAnimation >& animation );
60 
61  css::uno::Reference<
62  css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
63  const css::uno::Sequence<
64  css::uno::Reference<
65  css::rendering::XBitmap > >& animationBitmaps,
66  sal_Int8 interpolationMode );
67 
68  css::uno::Reference<
69  css::rendering::XCustomSprite > createCustomSprite(
70  const css::geometry::RealSize2D& spriteSize );
71 
72  css::uno::Reference<
73  css::rendering::XSprite > createClonedSprite(
74  const css::uno::Reference< css::rendering::XSprite >& original );
75 
89  bool updateScreen( const ::basegfx::B2IRectangle& rCurrArea,
90  bool bUpdateAll,
91  bool& io_bSurfaceDirty );
92 
93 
94  // SpriteRedrawManager functor calls
95 
96 
99  void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
100 
117  void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
118  const ::basegfx::B2DRange& rMoveEnd,
119  const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
120 
121  void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
122  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
123 
124  void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
125  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
126 
127  private:
130 
133 
136 
137  std::shared_ptr<canvas::ISurfaceProxyManager> mpSurfaceProxy;
138 
141 
143  mutable ::basegfx::B2IRange maUpdateRect;
144 
146  mutable ::basegfx::B2IRange maScrapRect;
147 
150  };
151 }
152 
153 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVASHELPER_HXX
154 
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class for basic canvas functionality.
signed char sal_Int8
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr
mutable::basegfx::B2IRange maUpdateRect
Completely temporary rect storage (used by sprite repaint)
void disposing()
Dispose all internal references.
mutable::basegfx::B2IRange maScrapRect
Completely temporary rect storage (used by sprite repaint)
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
This class manages smooth SpriteCanvas updates.
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
DXSurfaceBitmapSharedPtr mpBackBuffer
Backbuffer, contains the static canvas render output.
void init(SpriteCanvas &rParent,::canvas::SpriteRedrawManager &rManager, const IDXRenderModuleSharedPtr &rRenderModule, const std::shared_ptr< canvas::ISurfaceProxyManager > &rSurfaceProxy, const DXSurfaceBitmapSharedPtr &rBackBuffer, const ::basegfx::B2ISize &rOutputOffset)
std::shared_ptr< canvas::ISurfaceProxyManager > mpSurfaceProxy
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
std::shared_ptr< DXSurfaceBitmap > DXSurfaceBitmapSharedPtr
SpriteCanvas * mpSpriteSurface
For generating sprites.
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
bool updateScreen(const ::basegfx::B2IRectangle &rCurrArea, bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
Product of this component's factory.
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
bool mbShowSpriteBounds
When true, show small bound rects around each sprite.
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
IDXRenderModuleSharedPtr mpRenderModule
DX device, handling all low-level rendering.