Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / directx / dx_spritedevicehelper.hxx
blobdaced3bf34cf2ab99c322038925c96267257c751
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_SPRITEDEVICEHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITEDEVICEHELPER_HXX
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/rendering/XGraphicDevice.hpp>
25 #include <com/sun/star/rendering/XBufferController.hpp>
27 #include "dx_rendermodule.hxx"
28 #include "dx_surfacebitmap.hxx"
29 #include "dx_devicehelper.hxx"
31 #include <canvas/rendering/isurfaceproxymanager.hxx>
33 #include <boost/utility.hpp>
36 namespace dxcanvas
38 class SpriteCanvas;
40 class SpriteDeviceHelper : public DeviceHelper
42 public:
43 SpriteDeviceHelper();
45 void init( vcl::Window& rWindow,
46 SpriteCanvas& rSpriteCanvas,
47 const ::com::sun::star::awt::Rectangle& rRect,
48 bool bFullscreen );
50 /// Dispose all internal references
51 void disposing();
53 // partial override XWindowGraphicDevice
54 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
55 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
56 const ::com::sun::star::geometry::IntegerSize2D& size );
57 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
58 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
59 const ::com::sun::star::geometry::IntegerSize2D& size );
60 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
61 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
62 const ::com::sun::star::geometry::IntegerSize2D& size );
63 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
64 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
65 const ::com::sun::star::geometry::IntegerSize2D& size );
67 bool hasFullScreenMode( );
68 bool enterFullScreenMode( bool bEnter );
70 void destroyBuffers( );
71 sal_Bool showBuffer( bool bIsVisible, sal_Bool bUpdateAll );
72 sal_Bool switchBuffer( bool bIsVisible, sal_Bool bUpdateAll );
74 const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; }
75 const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; }
76 const ::canvas::ISurfaceProxyManagerSharedPtr &getSurfaceProxy() const { return mpSurfaceProxyManager; }
78 ::com::sun::star::uno::Any isAccelerated() const;
80 void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
82 /** called when DumpScreenContent property is enabled on
83 XGraphicDevice, and writes out bitmaps of current screen.
85 void dumpScreenContent() const;
87 private:
88 void resizeBackBuffer( const ::basegfx::B2ISize& rNewSize );
89 HWND getHwnd() const;
91 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
92 SpriteCanvas* mpSpriteCanvas;
94 DXSurfaceBitmapSharedPtr mpBackBuffer;
96 /// Instance passing out HW textures
97 ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxyManager;
99 /// Our encapsulation interface to DirectX
100 IDXRenderModuleSharedPtr mpRenderModule;
104 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITEDEVICEHELPER_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */