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 #pragma once
21 
22 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
23 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
24 
25 #include <spriteredrawmanager.hxx>
28 
30 #include "dx_impltools.hxx"
31 #include "dx_rendermodule.hxx"
32 #include "dx_surfacebitmap.hxx"
33 
35 
36 namespace dxcanvas
37 {
38  class SpriteCanvas;
39 
41  {
42  public:
44 
45  void init( SpriteCanvas& rParent,
46  ::canvas::SpriteRedrawManager& rManager,
47  const IDXRenderModuleSharedPtr& rRenderModule,
48  const std::shared_ptr<canvas::ISurfaceProxyManager>& rSurfaceProxy,
49  const DXSurfaceBitmapSharedPtr& rBackBuffer,
50  const ::basegfx::B2ISize& rOutputOffset );
51 
53  void disposing();
54 
55  // XSpriteCanvas
56  css::uno::Reference<
57  css::rendering::XAnimatedSprite > createSpriteFromAnimation(
58  const css::uno::Reference< css::rendering::XAnimation >& animation );
59 
60  css::uno::Reference<
61  css::rendering::XAnimatedSprite > createSpriteFromBitmaps(
62  const css::uno::Sequence<
63  css::uno::Reference<
64  css::rendering::XBitmap > >& animationBitmaps,
65  sal_Int8 interpolationMode );
66 
67  css::uno::Reference<
68  css::rendering::XCustomSprite > createCustomSprite(
69  const css::geometry::RealSize2D& spriteSize );
70 
71  css::uno::Reference<
72  css::rendering::XSprite > createClonedSprite(
73  const css::uno::Reference< css::rendering::XSprite >& original );
74 
88  bool updateScreen( const ::basegfx::B2IRectangle& rCurrArea,
89  bool bUpdateAll,
90  bool& io_bSurfaceDirty );
91 
92 
93  // SpriteRedrawManager functor calls
94 
95 
98  void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
99 
116  void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
117  const ::basegfx::B2DRange& rMoveEnd,
118  const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
119 
120  void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
121  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
122 
123  void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
124  const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
125 
126  private:
129 
132 
135 
136  std::shared_ptr<canvas::ISurfaceProxyManager> mpSurfaceProxy;
137 
140 
142  mutable ::basegfx::B2IRange maUpdateRect;
143 
145  mutable ::basegfx::B2IRange maScrapRect;
146 
149  };
150 }
151 
152 /* 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.