1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _DXCANVAS_SPRITEDEVICEHELPER_HXX
29 #define _DXCANVAS_SPRITEDEVICEHELPER_HXX
31 #include <com/sun/star/awt/Rectangle.hpp>
32 #include <com/sun/star/rendering/XGraphicDevice.hpp>
33 #include <com/sun/star/rendering/XBufferController.hpp>
35 #include "dx_rendermodule.hxx"
36 #include "dx_surfacebitmap.hxx"
37 #include "dx_devicehelper.hxx"
39 #include <canvas/rendering/isurfaceproxymanager.hxx>
41 #include <boost/utility.hpp>
47 class SpriteCanvasHelper
;
49 class SpriteDeviceHelper
: public DeviceHelper
54 void init( Window
& rWindow
,
55 SpriteCanvas
& rSpriteCanvas
,
56 const ::com::sun::star::awt::Rectangle
& rRect
,
59 /// Dispose all internal references
62 // partial override XWindowGraphicDevice
63 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleBitmap(
64 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
65 const ::com::sun::star::geometry::IntegerSize2D
& size
);
66 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileBitmap(
67 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
68 const ::com::sun::star::geometry::IntegerSize2D
& size
);
69 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
> createCompatibleAlphaBitmap(
70 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
71 const ::com::sun::star::geometry::IntegerSize2D
& size
);
72 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XVolatileBitmap
> createVolatileAlphaBitmap(
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XGraphicDevice
>& rDevice
,
74 const ::com::sun::star::geometry::IntegerSize2D
& size
);
76 sal_Bool
hasFullScreenMode( );
77 sal_Bool
enterFullScreenMode( sal_Bool bEnter
);
79 ::sal_Int32
createBuffers( ::sal_Int32 nBuffers
);
80 void destroyBuffers( );
81 ::sal_Bool
showBuffer( bool bIsVisible
, ::sal_Bool bUpdateAll
);
82 ::sal_Bool
switchBuffer( bool bIsVisible
, ::sal_Bool bUpdateAll
);
84 const IDXRenderModuleSharedPtr
& getRenderModule() const { return mpRenderModule
; }
85 const DXSurfaceBitmapSharedPtr
& getBackBuffer() const { return mpBackBuffer
; }
86 const ::canvas::ISurfaceProxyManagerSharedPtr
&getSurfaceProxy() const { return mpSurfaceProxyManager
; }
88 ::com::sun::star::uno::Any
isAccelerated() const;
90 void notifySizeUpdate( const ::com::sun::star::awt::Rectangle
& rBounds
);
92 /** called when DumpScreenContent property is enabled on
93 XGraphicDevice, and writes out bitmaps of current screen.
95 void dumpScreenContent() const;
98 void resizeBackBuffer( const ::basegfx::B2ISize
& rNewSize
);
101 /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
102 SpriteCanvas
* mpSpriteCanvas
;
104 DXSurfaceBitmapSharedPtr mpBackBuffer
;
106 /// Instance passing out HW textures
107 ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxyManager
;
109 /// Our encapsulation interface to DirectX
110 IDXRenderModuleSharedPtr mpRenderModule
;
114 #endif /* _DXCANVAS_SPRITEDEVICEHELPER_HXX */