Simplify a bit
[LibreOffice.git] / canvas / source / directx / dx_spritecanvashelper.hxx
blob5c2d98ba818e96cf42fb59c35221a618c0f847c5
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/XSpriteCanvas.hpp>
23 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
25 #include <spriteredrawmanager.hxx>
26 #include <rendering/isurfaceproxy.hxx>
27 #include <rendering/isurfaceproxymanager.hxx>
29 #include "dx_bitmapcanvashelper.hxx"
30 #include "dx_impltools.hxx"
31 #include "dx_rendermodule.hxx"
32 #include "dx_surfacebitmap.hxx"
34 #include <basegfx/range/b2irectangle.hxx>
36 namespace dxcanvas
38 class SpriteCanvas;
40 class SpriteCanvasHelper : public BitmapCanvasHelper
42 public:
43 SpriteCanvasHelper();
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 );
52 /// Dispose all internal references
53 void disposing();
55 // XSpriteCanvas
56 css::uno::Reference<
57 css::rendering::XAnimatedSprite > createSpriteFromAnimation(
58 const css::uno::Reference< css::rendering::XAnimation >& animation );
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 );
67 css::uno::Reference<
68 css::rendering::XCustomSprite > createCustomSprite(
69 const css::geometry::RealSize2D& spriteSize );
71 css::uno::Reference<
72 css::rendering::XSprite > createClonedSprite(
73 const css::uno::Reference< css::rendering::XSprite >& original );
75 /** Actually perform the screen update
77 @param rCurrArea
78 Current window area in absolute screen coordinates
80 @param bUpdateAll
81 sal_True, if everything must be updated, not only changed
82 sprites
84 @param io_bSurfaceDirty
85 In/out parameter, whether backbuffer surface is dirty (if
86 yes, we're performing a full update, anyway)
88 bool updateScreen( const ::basegfx::B2IRectangle& rCurrArea,
89 bool bUpdateAll,
90 bool& io_bSurfaceDirty );
93 // SpriteRedrawManager functor calls
96 /** Gets called for simple background repaints
98 void backgroundPaint( const ::basegfx::B2DRange& rUpdateRect );
100 /** Gets called when area can be handled by scrolling.
102 Called method must copy screen content from rMoveStart to
103 rMoveEnd, and restore the background in the uncovered
104 areas.
106 @param rMoveStart
107 Source rect of the scroll
109 @param rMoveEnd
110 Dest rect of the scroll
112 @param rUpdateArea
113 All info necessary, should rMoveStart be partially or
114 fully outside the outdev
116 void scrollUpdate( const ::basegfx::B2DRange& rMoveStart,
117 const ::basegfx::B2DRange& rMoveEnd,
118 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea );
120 void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
121 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
123 void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
124 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
126 private:
127 /// For generating sprites
128 SpriteCanvas* mpSpriteSurface;
130 /// Set from the SpriteCanvas: instance coordinating sprite redraw
131 ::canvas::SpriteRedrawManager* mpRedrawManager;
133 /// DX device, handling all low-level rendering
134 IDXRenderModuleSharedPtr mpRenderModule;
136 std::shared_ptr<canvas::ISurfaceProxyManager> mpSurfaceProxy;
138 /// Backbuffer, contains the static canvas render output
139 DXSurfaceBitmapSharedPtr mpBackBuffer;
141 /// Completely temporary rect storage (used by sprite repaint)
142 mutable ::basegfx::B2IRange maUpdateRect;
144 /// Completely temporary rect storage (used by sprite repaint)
145 mutable ::basegfx::B2IRange maScrapRect;
147 /// When true, show small bound rects around each sprite
148 bool mbShowSpriteBounds;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */